[R] logical subsetting, indexes and NAs
Federico Calboli
f.calboli at imperial.ac.uk
Sat Jan 28 21:36:14 CET 2012
Dear All,
just a quick example:
> x = 1:25
> x[12] = NA
> x
[1] 1 2 3 4 5 6 7 8 9 10 11 NA 13 14 15 16 17 18 19 20 21 22 23 24 25
> y = x[x<10]
> y
[1] 1 2 3 4 5 6 7 8 9 NA
Is there any way of NOT getting NA for y = x[x<10]? Similarly
> y = x[x<15]
> y
[1] 1 2 3 4 5 6 7 8 9 10 11 NA 13 14
How do I get rid of the NA (not post hoc)?
BW
F
--
Federico C. F. Calboli
Neuroepidemiology and Ageing Research
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
More information about the R-help
mailing list