Suppose the following data.frame
:
set.seed(1)
dados <- data.frame(y=rnorm(100), x1=rnorm(100), x2=rnorm(100), x3=rnorm(100), x4=rnorm(100))
If I want to run a regression of y against x1
... xn
, I can do it as follows:
modelo <- lm(y~x1+x2+x3+x4, data=dados)
In this case since it only has 4 variables, it is not exhaustive to describe them all. But supposing there were 100 variables, that is, from x1
to x100
. How to select all in an easy way for regression?