Re: [Rd] scoping/non-standard evaluation issue

2011-01-06 Thread peter dalgaard
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 p

Re: [Rd] scoping/non-standard evaluation issue

2011-01-06 Thread Kenn Konstabel
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) When experimenting with this I once had (by mistake): mod.2 <- lm(update(mod.1, . ~ . - Year + Year)) # instead

Re: [Rd] scoping/non-standard evaluation issue

2011-01-05 Thread John Fox
t; > > > >> -Original Message- > >> From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r-project.org] > > On > >> Behalf Of Gabor Grothendieck > >> Sent: January-04-11 6:56 PM > >> To: John Fox > >> Cc: Sanford Weisber

Re: [Rd] scoping/non-standard evaluation issue

2011-01-05 Thread peter dalgaard
gt; Hamilton, Ontario, Canada > web: socserv.mcmaster.ca/jfox > > >> -Original Message- >> From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r-project.org] > On >> Behalf Of Gabor Grothendieck >> Sent: January-04-11 6:56 PM >> To: John

Re: [Rd] scoping/non-standard evaluation issue

2011-01-05 Thread John Fox
ehalf Of Gabor Grothendieck > Sent: January-04-11 6:56 PM > To: John Fox > Cc: Sanford Weisberg; r-devel@r-project.org > Subject: Re: [Rd] scoping/non-standard evaluation issue > > On Tue, Jan 4, 2011 at 4:35 PM, John Fox wrote: > > Dear r-devel list members, > > > > O

Re: [Rd] scoping/non-standard evaluation issue

2011-01-05 Thread John Fox
a web: socserv.mcmaster.ca/jfox > -Original Message- > From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r-project.org] On > Behalf Of peter dalgaard > Sent: January-04-11 6:05 PM > To: John Fox > Cc: 'Sanford Weisberg'; r-devel@r-project.org > Su

Re: [Rd] scoping/non-standard evaluation issue

2011-01-04 Thread Gabor Grothendieck
On Tue, Jan 4, 2011 at 4:35 PM, John Fox wrote: > Dear r-devel list members, > > On a couple of occasions I've encountered the issue illustrated by the > following examples: > > - snip --- > >> mod.1 <- lm(Employed ~ GNP.deflator + GNP + Unemployed + > +         Armed.Forces + Popu

Re: [Rd] scoping/non-standard evaluation issue

2011-01-04 Thread peter dalgaard
On Jan 4, 2011, at 22:35 , John Fox wrote: > Dear r-devel list members, > > On a couple of occasions I've encountered the issue illustrated by the > following examples: > > - snip --- > >> mod.1 <- lm(Employed ~ GNP.deflator + GNP + Unemployed + > + Armed.Forces + Popu

Re: [Rd] scoping/non-standard evaluation issue

2011-01-04 Thread John Fox
Dear all, A small correction: I had a stray line in my f2(), env <- new.env(parent=.GlobalEnv) left over from yet another attempt; it can simply be removed. Sorry for the confusion, John John Fox Senator William McMaster Professor of Social Statisti