[R] R Equivalent to matlab's find() command?
ligges at statistik.uni-dortmund.de
Thu Jun 8 15:27:51 CEST 2000
Stephen Eglen wrote:
> Just a very simple question: is there an R equivalent to the matlab
> command find(X) which returns the indices of vector X that store
> non-zero elements?
> > find( [1 0 0 1 0])
> ans =
> 1 4
> so, in R, how do I do:
> ans <- rfind( c(1,0,0,1,0))
> so that ans is the vector c(1,4)
Sorry, first answer was wrong!
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help