[R] How to get vector of poitions in a vector ?

2010-07-23 Thread vikrant
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-tp227p227.html Sent from the R help

Re: [R] How to get vector of poitions in a vector ?

2010-07-23 Thread Martyn Byng
(1:length(a))[a != 0] -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of vikrant Sent: 23 July 2010 12:13 To: r-help@r-project.org Subject: [R] How to get vector of poitions in a vector ? I have a vector a = c(1,0,0,0,1,0,4,0,0,0