On Jun 18, 2009, at 4:36 PM, Jack Luo wrote:
Hi,
I am trying to use glm to fit my data, wondering if there is a easy
way to
fit a glm without typing all the explanatory variable names. For
example, if
I have 100 explanatory variables x1, x2, ..., x100 and response
variable is
y, I don't want to do something like
glm1 <- glm(y ~ x1 + x2 + ... + x100, family = gaussian, data = dataA)
since it would be a lot of typing.
Many thanks,
-Jack
If y and x1 through x100 are the only variables in dataA, you can use:
glm(y ~ ., data = dataA)
The '.' in the formula indicates that all variables not already in the
formula should be used.
See ?formula for more information.
HTH,
Marc Schwartz
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.