[R] automating regression or correlations for many variables

geral geraldes at mail.ubc.ca
Mon Apr 4 22:33:15 CEST 2011


Thanks!

I must confess I am just a beginner, but I followed your suggestion and did
'm <- lm(as.matrix(snp[, -1])  ~ lat, data = snp) ' and it worked perfectly.
I would like to understand what is being done here. as.matrix I understand
makes my data frame be a matrix, but I don't understand the part snp[,-1]. I
think I am saying use all rows of... but I don't understand the -1, does
that mean, all columns but column 1?

I really appreciate the help! It was really really valuable. 

A related question is, what is m? If I do is.object(m) I get true. so I
guess it is an object. I now need to use each of the fitted models for more
things, such as calculate anova, etc... How do I do that? When I do this
column by column I just do anova(m), but it does not seem to work now...

Thanks!
AG

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



More information about the R-help mailing list