[Rd] Questions about calls and formulas
ggrothendieck at gmail.com
Tue Aug 23 00:55:38 CEST 2005
On 8/22/05, Erich Neuwirth <erich.neuwirth at univie.ac.at> wrote:
> >>(foo <- eval(substitute(x ~ g * h, list(x = as.name("weights")))))
> > weights ~ g * h
> >  "formula"
> x ~ g * h
> what needs to be done to ff for the substitution to work?
> I found a way of doing it using string substitution
> and applying formula (instead of as.call) to the string,
> but I would like to be able to do it using substitution.
> This is what I currently do:
> myexpr<-paste("weights ~",strsplit(deparse(m$formula),"~")[])
Try do.call like this:
ff <- x ~ g*h
do.call("substitute", list(ff, list(x = as.name("weight"))))
More information about the R-devel