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)


Carol

	[[alternative HTML version deleted]]

