[R] simple question on picking out some rows of a matrix/data frame
jfox at mcmaster.ca
Mon Feb 9 22:28:02 CET 2004
Something like mat[mat[,1] == mat[,2],] or mat[mat[,1] != mat[,2],]
should give you what you want.
I hope that this helps,
On 09 Feb 2004 12:22:48 -0800
Roger Levy <rog at stanford.edu> wrote:
> I have a simple question about matrix/data frame manipulation. I
> 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.
> How can I do that?
> Many thanks,
> Roger Levy
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide!
More information about the R-help