Java Mailing List Archive

http://www.r-help.com/

Home » Home (12/2007) » R Help for Statistical Computing »

[R] indexing a vector starting from 0

Federico Calboli

2005-07-24

Replies:

Hi All,

I would like to ask if it possible to start indexing a vector from 0:

x = 1:10

y = c(0,0,3,4,5,6,0,8,9,10)

I need to use y as an index to extract the values of x, BUT I cannot
cull/transform the 0s. What I would like is to start counting the
elements of x 0:9 rather than 1:10. Would this be at all possible?

Regards,

Federico Calboli
--
Federico C. F. Calboli
Department of Epidemiology and Public Health
Imperial College, St. Mary's Campus
Norfolk Place, London W2 1PG

Tel +44 (0)20 75941602  Fax +44 (0)20 75943193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com

______________________________________________
R-help@(protected)
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
©2008 r-help.com - Jax Systems, LLC, U.S.A.