[R] how to return indexes

demolombe demolomb at ensam.inra.fr
Thu Sep 5 11:04:54 CEST 2002


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

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