search for: indx2new

Displaying 1 result from an estimated 1 matches for "indx2new".

Did you mean: idx_new
2013 Sep 10
0
Looping an lapply linear regression function
Hi, Try: dat2<- read.csv("BOlValues.csv",header=TRUE,sep="\t",row.names=1) dim(dat2) #[1] 20 28 indx2<-expand.grid(names(dat2),names(dat2),stringsAsFactors=FALSE) nrow(indx2) #[1] 784 indx2New<- indx2[indx2[,1]!=indx2[,2],] nrow(indx2New) #[1] 756 res2<-sapply(seq_len(nrow(indx2New)),function(i) {x1<- indx2New[i,]; x2<-cbind(dat2[x1[,1]],dat2[x1[,2]]);summary(lm(x2[,1]~x2[,2]))$coef[,4][2]}) #changed here dat3<- cbind(indx2New,value=res2) dim(dat3) #[1] 756?? 3 library(re...