[R] switching elements of a vector
gunter.berton at gene.com
Mon May 24 16:12:40 CEST 2010
And, just for kicks, a yet another (somewhat inefficient)solution:
Genentech Nonclinical Statistics
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of speretti
Sent: Monday, May 24, 2010 3:03 AM
To: r-help at r-project.org
Subject: [R] switching elements of a vector
I would like to receive help for the following matter:
If I'm dealing with a numeric vectors containing increasing elements.
There exist an efficient way to obtain an vector that indicates the position
of the changing element of "a"?
In this case it would be something like:
usually I'm used cycles to obtain boolean vectors of the same length of "a"
indicating the changing elements ...later I've muliplied them for their
numeric sequence and after that I've selected elements different from zero
...it is quite long...
can you find an easier solution?
Thank you for you help
View this message in context:
Sent from the R help mailing list archive at Nabble.com.
R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
More information about the R-help