how to return indexes
On Thu, 5 Sep 2002, demolombe wrote:
Hello,
I wonder how to retreive indexes of data (and not data themseleves)
example: a vector x<-c(10,20,30,40,50,60)
a filter: f <- x>30 does retreive : 40,50,60
f <- x[x>30] retreive
false,false,false,true,true,true
i would retreive the indexes: 4,5,6 because the 4th, 5th and 6th values
were selected
(this easy with matlab, but with R I know only sort(..., index.return=TRUE)
which does that
thank you for help
Vincent
which(x > 30) --- G?ran Brostr?m tel: +46 90 786 5223 Department of Statistics fax: +46 90 786 6614 Ume? University http://www.stat.umu.se/egna/gb/ SE-90187 Ume?, Sweden e-mail: gb at stat.umu.se -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._