Re: [R] Using all variables in a linear model

2010-04-20 Thread Gabor Grothendieck
lm can take a data frame whose first column is the response so: lm(rev(x)) On Tue, Apr 20, 2010 at 6:12 PM, Walter Yund IV wrote: > Hello, > > I am trying to automate linear regression for many different datasets, each > with the same rough format (the last variable is the response).  I've been

Re: [R] Using all variables in a linear model

2010-04-20 Thread Joshua Wiley
What about using x[,-predictor]. For instance: x <- matrix(1:9, nrow=3) x[,-2] # all but the second column Perhaps using your code it would be something like... lm=lm(x[,dim(x)[2]] ~ x[,-dim(x)[2]], data=x) Best regards, Josh On Tue, Apr 20, 2010 at 3:12 PM, Walter Yund IV wrote: > Hello, >