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

Jens Oehlschlägel-Akiyoshi jens.oehlschlaegel-akiyoshi at mdfactory.de
Thu Jun 8 17:18:33 CEST 2000



Concerning speed and memory efficiency I find

  as.logical(x) 

is better than 

  x!=0

and 

  seq(along=x)[as.logical(x)] 

is better than 

  which(as.logical(x))

thus 

  which(x!=0)

is shortest and

  rfind <- function(x)seq(along=x)[as.logical(x)] 

seems to be computationally most efficient


> version
         _         
platform Windows NT 4.0
arch     x86       
os       Win32     
system   x86, Win32
status             
major    1         
minor    0.1       
year     2000      
month    April     
day      14        
language R 
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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