Re: [R] quoting expressions in a list

2009-07-16 Thread Stavros Macrakis
On Thu, Jul 16, 2009 at 4:44 PM, Erik Iverson wrote: > I have a list of logical expressions, and I would really like it if the > "names" of the components of the list were identical to the corresponding > logical expression. > > So, as an example: > > df.example <- data.frame(a = 1:10, b = rnorm(

Re: [R] quoting expressions in a list

2009-07-16 Thread Gabor Grothendieck
Try this: > s <- c("df.example$a > 7", "df.example$b < 4") > sapply(s, function(x) eval(parse(text = x))) df.example$a > 7 df.example$b < 4 [1,]FALSE TRUE [2,]FALSE TRUE [3,]FALSEFALSE [4,]FALSE