[R] beginner's question: group of regressors by name vector?
ggrothendieck at gmail.com
Thu Feb 12 17:21:01 CET 2009
If DF is a data frame with the variables, try this:
lm(l ~. , DF[c("l", "b", "j", "x"))
On Thu, Feb 12, 2009 at 11:11 AM, <ivowel at gmail.com> wrote:
> dear r-experts: there is probably a very easy way to do it, but it eludes
> me right now. I have a large data frame with, say, 26 columns named "a"
> through "z". I would like to define "sets of regressors" from this data
> frame. something like
> myregressors=c("b", "j", "x")
> lm( l ~ myregressors, data=... )
> is the best way to create new data frames that contain all the variables I
> want, then use ".", and then destroy them again? or am I overlooking
> something obvious?
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help