[R] vector of NA indices

Martin Maechler maechler at stat.math.ethz.ch
Wed Jul 14 17:13:57 CEST 1999


    PBM> I have a vector Pes with 600 elements some of which are NA's. How can I
    PBM> form a vector of the indices of the NA's.

    PBM> for(i in 1:600) if(is.na(Pes[i])) print(i)

    PBM> prints the indices of the NA's but I can't figure out how to put the
    PBM> results in a vector.

which(is.na(Pes))

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