Skip to content
Prev 305641 / 398506 Next

eval(parse(...)) only once in a function

On Sep 16, 2012, at 11:27 PM, Christof Klu? wrote:

            
What are you trying to do?

str <- quote(df$JT == 12)
Implement what?  And what issues regarding "performance" are relevant? What does it mean to "not evaluate at each function call"?

str <- quote(df$JT == 12)
fun <- function(df) {
    b<-eval(str)
    return(b)
   }

df3 <- data.frame(JT=12)
fun(df3)
#[1] TRUE