Dear All,

I have a large data frame with 10 rows and 82 columns. I want to apply the
same function to all of the columns with a single command. e.g. zl <- lm
(snp$a_109909 ~ snp$lat) will fit a linear model to the values in lat and 
a_109909. What I want to do is fit linear models for the values in each
column against lat. I tried doing zl <- (snp[,2:82] ~ snp$lat[,1]) but got
the following error message "Error in model.frame.default(formula = snp[,
2:82] ~ snp[, 1], drop.unused.levels = TRUE) : 
  invalid type (list) for variable 'snp[, 2:82]'". Does this mean I cannot
use a data frame to do this? Should I have my data in a matrix instead?

Thanks

--
View this message in context: 
http://r.789695.n4.nabble.com/automating-regression-or-correlations-for-many-variables-tp3426091p3426091.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to