[R] Removing terms from formula
McGehee, Robert
Robert.McGehee at geodecapital.com
Wed Nov 29 23:28:34 CET 2006
R-help,
Given a simple linear model, say lm(x ~ y + z), I would like to remove
model terms that are factors with only one level. Thus, if 'z' were a
factor with only one level, lm(x ~ y + z) becomes lm(x ~ y + 1).
Likewise, if both 'y' and 'z' are one-level factors, then the resulting
calculation is simply lm(x ~ 1).
Unfortunately, I have not been able to come up with an elegant solution
to this. Any suggestions would be greatly appreciated.
Thanks,
Robert
Robert McGehee, CFA
Quantitative Analyst
Geode Capital Management, LLC
One Post Office Square, 28th Floor | Boston, MA | 02109
Tel: 617/392-8396 Fax:617/476-6389
mailto:robert.mcgehee at geodecapital.com
This e-mail, and any attachments hereto, are intended for us...{{dropped}}
More information about the R-help
mailing list