[R] quoting expressions in a list

Erik Iverson eiverson at NMDP.ORG
Thu Jul 16 22:44:41 CEST 2009


Dear R-help,

I am having quite a difficult time coming up with what I want to do involving named lists. 

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(10, 5))

list.example <- list(df.example$a > 7,
                     df.example$b < 4)

Now what I'd really like is to name the components, and get the results of the following line without having to specify the right-hand side individually for each component: 

names(list.example) <- c("df.example$a > 7", "df.example$b < 4")


Any ideas?  

Best Regards,
Erik Iverson




More information about the R-help mailing list