[R] confused with vector subsetting
Laurent Gautier
laurent at cbs.dtu.dk
Fri Jul 5 18:34:25 CEST 2002
Dear all,
I do not know whether the following results from an obscure feature
of R or from my misunderstanding.
> x <- 1:3
> x[-which(x == 2)]
[1] 1 3
> x[-which(x == 4)]
numeric(0)
(I would have expected something like '[1] 1 2 3' at that point)
Thanks in advance for any advice.
Laurent
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list