[R] proper work-flow with 'formula' objects and lm()

Liviu Andronic landronimirc at gmail.com
Thu Nov 24 22:10:41 CET 2011


On Thu, Nov 24, 2011 at 9:14 PM, Duncan Murdoch
<murdoch.duncan at gmail.com> wrote:
> It is retained.  terms(fit) will give it to you, if fit is an lm object.
>

Thank you. The following works nicely.
> (form <- formula(y1~x1))
y1 ~ x1
> x <- lm(form, anscombe)
> formula(terms(x))
y1 ~ x1


However, I was hoping that there was a way to input the 'form' object
so that summary(x) would print the underlying formula used, not the
formula object name. I was thinking of something in the style of
x <- lm(deparse(form), anscombe)
summary(x)

Can this be done? Regards
Liviu



More information about the R-help mailing list