On Jan 6, 2011, at 13:11 , Kenn Konstabel wrote:

> the following seems an easy solution:
> 
> f1 <- function(mod){
>     subs <- 1:10
>     toeval <- quote(update(mod, subset=subs))
>     toeval$subset<-subs
>     eval(toeval)
>     }
> 
> f1(mod.2)

Tere, Kenn!

Yes, enforcing pass-by-value by pre-evaluating the argument will certainly 
defeat the nonstandard evaluation issues. Another version of the same idea is

eval(bquote(update(mod, .(subs)))

The only thing is that if the argument is ever deparsed, you might get a messy 
display. E.g., try eval(bquote(plot(.(rnorm(20)))))


-pd

-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd....@cbs.dk  Priv: pda...@gmail.com

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to