[R] odd, even indices of a vector
gunter.berton at gene.com
Tue Jul 22 06:10:39 CEST 2014
Unless I have seriously misjudged, you really really really need to go
through an R tutorial -- An Intro to R ships with R, but there are
many on the web -- before posting here further. You do not appear to
have made much of an effort to learn even the basics, and I consider
it unfair to post questions here on basic matters that a tutorial
would tell you about.
And, of course, my apologies if I have gotten it wrong.
Genentech Nonclinical Biostatistics
"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
On Mon, Jul 21, 2014 at 1:33 PM, carol white <wht_crl at yahoo.com> wrote:
> Might be a trivial question but how to identify the odd and even indices of a vector?
> x = c(1,z,w,2,6,7)
> el of odd indices= 1,w,6
> el of even indices= z,2,7
> given the def of odd and even in https://stat.ethz.ch/pipermail/r-help/2010-July/244299.html
> should a loop be used?
> for (i in 1: length(x))
> if (is.odd(i)) print (i)
> [[alternative HTML version deleted]]
> 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