[R] Delete rows from matrix having at least one zero value
mentor_
mentor_ at gmx.net
Sun Nov 9 13:39:32 CET 2008
Hi,
I have a further question about matrix manipulation.
Imagine the following two matrices:
> test
[,1] [,2] [,3] [,4]
[1,] 1 0 6 4
[2,] 2 5 7 5
[3,] 3 6 8 6
[4,] 4 0 0 0
> matrix(is.element(test,0), ncol=4)
[,1] [,2] [,3] [,4]
[1,] FALSE TRUE FALSE FALSE
[2,] FALSE FALSE FALSE FALSE
[3,] FALSE FALSE FALSE FALSE
[4,] FALSE TRUE TRUE TRUE
How can I apply the TRUE FALSE matrix to the 'test' matrix so that all rows
having at least one zero value will be thrown out.
So after applying the TRUE FALSE matrix the test matrix shoud look like the
following:
[,1] [,2] [,3] [,4]
[1,] 2 5 7 5
[2,] 3 6 8 6
Cheers
--
View this message in context: http://www.nabble.com/Delete-rows-from-matrix-having-at-least-one-zero-value-tp20405964p20405964.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list