c <- 3 # set the initial numbers
d <- acadfull[,c]
i <- 1
p <- 1
data <- data.frame()
while (i < 123 ) { #loop
ANS <- lm(caco ~ d, data=acadfull)
data[p,1] <- ANS$coefficients
c <- c+1
i <- i+1
p <- p+1
d <- acadfull[,c]
if (i==123)
break
}
write.csv(c(snp,pos,data),"reg_results", row.names=F)
Any help would really be appreciated! When I run the above script, I get an error message saying
Error in `[<-.data.frame`(`*tmp*`, p, 1, value = c(1.48484848484849, -0.0104895104895094, :
replacement has 6 rows, data has 1
I get the error when this line is run
ANS <- lm(caco ~ d, data=acadfull)