[Rd] subset: evaluating expressions missing? (PR#6937)

martin.lenze at web.de martin.lenze at web.de
Fri Jun 4 12:04:12 CEST 2004


Full_Name: Martin Lenze
Version: Version 1.9.0  (2004-04-12), ISBN 3-900051-00-3
OS: Microsoft Windows 2000 [Version 5.00.2195] SP4
Submission from: (NULL) (82.83.167.79)


Hello,

now I switched to R 1.9.0 and did get a problem with subset, see sample:

x <- data.frame(a=as.integer(round(runif(5),0)), 
  b=as.integer(round(runif(5),0)),c=as.integer(round(runif(5),0)))
# correct results:
for (c in c(expression(x$a==1),expression(x$b==1),
  expression(x$c==1))) print(x[eval(c),])
# results I don't understand:
for (c in c(expression(x$a==1),expression(x$b==1),
  expression(x$c==1))) print(subset(x,eval(c)))
for (c in c(expression(x$a==1),expression(x$b==1),
  expression(x$c==1))) print(subset(x,c))

Am I doing something wrong? Using subset this way with R 1.8.0 worked fine.

Many thanks in advance
Martin Lenze



More information about the R-devel mailing list