Re: [R] automating regression or correlations for many variables

From: geral <>
Date: Mon, 04 Apr 2011 15:33:15 -0500 (CDT)


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...


View this message in context:
Sent from the R help mailing list archive at

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Mon 04 Apr 2011 - 20:36:20 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 04 Apr 2011 - 23:00:27 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive