Skip to content

Access to column names stored in a vector in lm procedure

2 messages · mcnpf748 at mncn.csic.es, Gabor Grothendieck

#
You can regress multiple dependent variables at once by placing them
in a matrix.   For example, this regresses each of the first 4 columns of
the builtin iris dataset against Species, the last column:

iris4 <- as.matrix(iris[,-5])
summary(lm(iris4 ~ Species, iris))
On 2/2/07, mcnpf748 at mncn.csic.es <mcnpf748 at mncn.csic.es> wrote: