[R] Excluding rows from a matrix

José Ernesto Jardim ernesto at ipimar.pt
Mon Aug 21 17:34:36 CEST 2000


Peter Dalgaard BSA wrote:

> José Ernesto Jardim <ernesto at ipimar.pt> writes:
>
> > Hi
> >
> > I have a matrix (4 x 950) and I want to remove 3 rows, where the values
> > from the first column are 713, 714 and 715. I can select the rows, one
> > by one, with
> >
> > mat[mat$first==713,]
> > mat[mat$first==714,]
> > ...
> >
> > but I'm unable to (i) select the 3 rows at once, (ii) select the matrix
> > excluding those rows.
> >
> > How can I do it ?
>
> Um, if you can do that, then mat is a dataframe, not a matrix!
>
> Something like
>
> mat[!(mat$first %in% 713:715),]
>
> would seem to work.
>
> --
>    O__  ---- Peter Dalgaard             Blegdamsvej 3
>   c/ /'_ --- Dept. of Biostatistics     2200 Cph. N
>  (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
> ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-

Yes, it worked !!

thanks

EJ

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list