Re: [R] Linear regression repeat for each column

2013-07-20 Thread arun
Hi, set.seed(28) dat1<- as.data.frame(matrix(sample(1:20,100,replace=TRUE),ncol=10)) set.seed(49) dat2<- as.data.frame(matrix(sample(40:80,100,replace=TRUE),ncol=10))  lapply(seq_len(ncol(dat1)),function(i) {lm(dat2[,i]~dat1[,i])}) A.K. - Original Message - From: iza.ch1 To: r-help@r-pr

Re: [R] Linear regression repeat for each column

2013-07-20 Thread Jeff Newmiller
Sure. Read the Posting Guide, and provide a reproducible example with sample data. I suspect the basic idea will be to merge the data frames and then setup the model to refer to the desired columns. --- Jeff Newmiller