From martin.lenze at web.de  Fri Jun  4 12:04:12 2004
From: martin.lenze at web.de (martin.lenze@web.de)
Date: Fri Jun  4 12:04:14 2004
Subject: [Rd] subset: evaluating expressions missing? (PR#6937)
Message-ID: <20040604100412.BF0DC1097F@slim.kubism.ku.dk>

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


[Rd] subset: evaluating expressions missing? (PR#6937)
martin.lenze@web.de