[R] Problem with lme, ns and df (variable scoping problem?)

Hadley Wickham h.wickham at auckland.ac.nz
Thu Jan 22 02:21:39 CET 2004

That makes sense - obviously when I used this formulation in the past 
(eg. with lm) I've been lucky enough not to run into problems, but it 
makes sense that the formula needs some help to determine that df comes 
from a different environment from the other variables.

Thanks for your help,


Prof Brian Ripley wrote:

>Use substitute, something like
>lml <- eval(substitute(lmList(y ~ ns(x,df=d.f) | c, a), list(d.f.=df)))
>This sort of thing is in any case necessary to get a sensible call
>component recorded in the fitted object.

More information about the R-help mailing list