[R] proper work-flow with 'formula' objects and lm()
landronimirc at gmail.com
Thu Nov 24 20:48:23 CET 2011
I have a work-flow issue with lm(). When I use
> lm(y1~x1, anscombe)
lm(formula = y1 ~ x1, data = anscombe)
I get as expected the formula, "y1 ~ x1", in the print()ed results or
summary(). However, if I pass through a formula object
> (form <- formula(y1~x1))
y1 ~ x1
> lm(form, anscombe)
lm(formula = form, data = anscombe)
then I only get the object name in the call, 'form', instead of the
formula. When passing a 'formula' object to lm, is it possible to
retain in the resulting 'lm' object the actual formula used for the
regression: "y1 ~ x1"?
Do you know how to read?
Do you know how to write?
More information about the R-help