Douglas Bates <[EMAIL PROTECTED]> writes:
[..snip..]
> However, I haven't been able to work out a clever way of using
> substitute to get the first part.  I would like to be able to call,
> e.g.
> 
> with(fm, xyplot(resid(.) ~ carb))
> 
> and get a plot of resid(fm) ~ Formaldehyde$carb
> 
> It is possible to do the first part by deparsing, substituting, and
> parsing but that's inelegant.  Can anyone suggest a more elegant
> method?

Here's part of one, I think:

> w <- function(x,y)eval(substitute(substitute(y,list(.=quote(x)))))
> w(fm, xyplot(resid(.) ~ carb))
xyplot(resid(fm) ~ carb)

(The double substitute is often needed in this type of problem. Things
would be easier if we had a version of substitute that didn't
automatically quote it's argument.)

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED])             FAX: (+45) 35327907

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

Reply via email to