A pretty straightforward for those with intimate knowledge of R
full <- lm(hello~., hellow)
In the above specification, linear regression is being used and hello is being modeled against all variables in dataset hellow
.
I have 33 variables in hellow
; I wish to specify some of those as independent variable. These variables have names that carry a meaning so I really don't want to rename them to x1
x2
etc.
How can I, without having to type the individual names of the variables (since that is pretty tedious), specify a select number of variables from the whole bunch?
I tried
full <- lm(hello~hellow[,c(2,5:9)]., hellow)
but it gave me an error "Error in model.frame.default(formula = hello ~ hellow[, : invalid type (list) for variable 'hellow[, c(2, 5:9)]'