Skip to content

how to generalize the arguments for lm() (r-help@lists.R-project.org)

3 messages · Math Girl, Dimitris Rizopoulos, Gabor Grothendieck

#
you can just use a design matrix on the right hand side of 'formula', e.g.,

factors <- matrix(rnorm(100*10), 100, 10)
y <- rnorm(100)

lm(y ~ factors)


I hope it helps.

Best,
Dimitris
Math Girl wrote:

  
    
#
Using the built in CO2 data frame this regresses uptake on all the
other columns:

lm(uptake ~., CO2)
On Sun, Dec 28, 2008 at 2:28 AM, Math Girl <mathmathgurl at yahoo.com> wrote: