Skip to content

Repating a loop of lm function with different columns of database

2 messages · Jon Toledo, Weidong Gu

#
If I understood your question

x<-data.frame(matrix(rnorm(2000,10,10),ncol=50))

sapply(1:5,function(i) summary(lm(x[,i]~x[,i+10]+x[,50])))

Weidong Gu
On Thu, Jul 14, 2011 at 2:27 PM, Jon Toledo <tintin_jb at hotmail.com> wrote: