[R] simple question on picking out some rows of a matrix/data frame

Thomas Lumley tlumley at u.washington.edu
Mon Feb 9 22:25:55 CET 2004


On Mon, 9 Feb 2004, Roger Levy wrote:

> Hi,
>
> I have a simple question about matrix/data frame manipulation.  I have
> a data frame that looks a something like this
>
>   X    Y    Z
>   1    0    "apples"
>   -1   -1   "oranges"
>   ...
>   0    -1   "bananas"
>
> and I'd like to pull out all the rows for which X and Y are (un)equal
> into a submatrix.
>

subset(the.data.frame,  X!=Y)

	-thomas




More information about the R-help mailing list