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

Martyn Byng Martyn.Byng at nag.co.uk
Fri Jul 23 14:56:23 CEST 2010


(1:length(a))[a != 0]

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of vikrant
Sent: 23 July 2010 12:13
To: r-help at 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)
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 at 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.

________________________________________________________________________
This e-mail has been scanned for all viruses by Star.\ _...{{dropped:12}}



More information about the R-help mailing list