[R] R Equivalent to matlab's find() command?

Peter Malewski y0004379 at tu-bs.de
Thu Jun 8 16:13:20 CEST 2000


Do you mean this:

> x <- c(1,0,0,1)
> which(x!=1)
[1] 1 4

?
Peter.

> command find(X) which returns the indices of vector X that store
> non-zero elements?
> 
> e.g.
> > find( [1 0 0 1 0])
> ans =

** To YOU I'm an atheist; to God, I'm the Loyal Opposition. Woody Allen **
P.Malewski					Tel.: 0531 500965
Maschplatz 8					Email: P.Malewski at tu-bs.de
************************38114 Braunschweig********************************

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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