[R] R Equivalent to matlab's find() command?
Kjetil Kjernsmo
kjetil.kjernsmo at astro.uio.no
Thu Jun 8 15:29:46 CEST 2000
On Thu, 8 Jun 2000, Stephen Eglen wrote:
>so, in R, how do I do:
>
>ans <- rfind( c(1,0,0,1,0))
>
>so that ans is the vector c(1,4)
You can do:
> which(c(1,0,0,1,0) != 0)
[1] 1 4
Best,
Kjetil
--
Kjetil Kjernsmo
Graduate astronomy-student Problems worthy of attack
University of Oslo, Norway Prove their worth by hitting back
E-mail: kjetikj at astro.uio.no - Piet Hein
Homepage <URL:http://www.astro.uio.no/~kjetikj/>
Webmaster at skepsis.no
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
mailing list