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

2011-04-04 Thread geral
Thanks! You are awesome! I am not sure I follow everything, but I am trying! AG -- View this message in context: http://r.789695.n4.nabble.com/automating-regression-or-correlations-for-many-variables-tp3426091p3426887.html Sent from the R help mailing list archive at Nabble.com. __

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

2011-04-04 Thread Dennis Murphy
Hi: On Mon, Apr 4, 2011 at 1:33 PM, geral wrote: > 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

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

2011-04-04 Thread geral
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 pa

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

2011-04-04 Thread Dennis Murphy
Hi: Here's a small example: > df <- data.frame(y1 = rnorm(10), y2 = rnorm(10), y3 = rnorm(10), lat = rnorm(10)) > m <- lm(cbind(y1, y2, y3) ~ lat, data = df) > summary(m) The LHS of the model formula needs to be a matrix. In your case, something like m <- lm(as.matrix(snp[, -1]) ~ lat, data =