Hi,

Given test <- matrix(c(0,2,0,1,3,5), 3,2)

> test[test>0]
[1] 2 1 3 5

These are values >0

> which(test>0)
[1] 2 4 5 6

These are array indices of those values >0

> which(apply(test>0, 1, all))
[1] 2

This gives the row whose elements are all >0

I can't seem to get indices of rows containing one or more elements >0

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to