[R] Extracting a row number from a matrix

JeeBee JeeBee at troefpunt.nl
Tue Aug 1 16:13:37 CEST 2006

> so in the following example (single column, but my real data has
> multiple columns) how do I  get the row number of the last row of x
> beyond which there are 10 or more 0's (which in this case is row#100).
> x <- as.matrix(c(rep(seq(1:20),5),rep(0,20)))

max( which(x > 0) )


More information about the R-help mailing list