Hi > a = c(1,0,0,0,1,0,4,0,0,0) > which(a!=0) [1] 1 5 7
Beware of floating point near zero values. Petr r-help-boun...@r-project.org napsal dne 23.07.2010 13:12:44: > > I have a vector a = c(1,0,0,0,1,0,4,0,0,0) > Now I want to get a vector of positions in a vector a where the value is non > zero.. > How to do it?? > > > -- > View this message in context: http://r.789695.n4.nabble.com/How-to-get-vector- > of-poitions-in-a-vector-tp2299997p2299997.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.