Hello, there,
I wonder if there is an easier way that I would only get the rows that
satisfies some condition. For example:I have the following matrix, and I would
like to output only the 3rd row and 4th row, since only these two rows contain
the numbers greater than 11
> a
[,1] [,2] [,3] [,4] [,5]
[1,] 1 5 9 13 17
[2,] 2 6 10 14 18
[3,] 3 7 11 15 19
[4,] 4 8 12 16 20
> a>11
[,1] [,2] [,3] [,4] [,5]
[1,] FALSE FALSE FALSE TRUE TRUE
[2,] FALSE FALSE FALSE TRUE TRUE
[3,] FALSE FALSE FALSE TRUE TRUE
[4,] FALSE FALSE TRUE TRUE TRUE
I have tried to use a[a>11, ] and it did not work.
Thanks a lot for the help:)
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.