Hi Thomas thx, already the e <- parse(text="df$str==12")[[1]] is nice. So I have not to call parse in my function! (The function is called very often, so it makes the program much faster.)
And eval(bquote(function(df) b<-.(e))) is great! That's exactly what I was looking for. Christof Am 17-09-2012 22:52, schrieb Thomas Lumley: > On Mon, Sep 17, 2012 at 6:27 PM, Christof Kluß <ckl...@email.uni-kiel.de> > wrote: >> but for performance "eval(parse(a))" should not be evaluated at each >> function call, but should work as >> > You can do it with bquote() > >> e<-parse(text="df$str==12")[[1]] >> e > df$str == 12 >> bquote(function(df) b<-.(e)) > function(df) b <- df$str == 12 >> eval(bquote(function(df) b<-.(e))) > function (df) > b <- df$str == 12 > > This saves more time than I expected, about 100ms per evaluation on my > computer. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.