[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)

Can this be done? Regards

More information about the R-help mailing list