[R] Linear regressions: producing multiple outputs

RTSlider rob.t.slider at gmail.com
Wed Feb 16 19:13:55 CET 2011


Hello all,
I’m running simple linear regressions on multiple species of plants,
comparing abiotic factor X against plant trait Y (e.g. Species1: leaf length
vs air temperature).

Ideally, what I’m looking for is an output giving me the R2, p value,
coefficient, and Y intercept for each regression. Something like the example
below:   

Species1: leaf length vs air temperature
	R2 = 0.10	p = 0.50	m = 5.23	b = 12.2
Species2: leaf length vs air temperature
	R2 = 0.10	p = 0.50	m = 5.23	b = 12.2

Species1: leaf length vs snow-free date
R2 = 0.10	p = 0.50	m = 5.23	b = 12.2
Species2: leaf length vs snow-free date
R2 = 0.10	p = 0.50	m = 5.23	b = 12.2

I currently have my data in this form:
Species	LeafLength		AirTemp.	SnowFreeDate
Species1	1.1			20		160
Species2	4.5			20		160
Species3	5.4			20		160

And thought I could try this formula:
lm(formula = LeafLength~AirTemp, SnowFreeDate | Species)

But R is not a fan of it. 
Is there a way to do this (or get something remotely close to this)? 
I realize the output will probably be a bit messier than this, but what I’m
really looking to avoid is running these regressions individually.

-- 
View this message in context: http://r.789695.n4.nabble.com/Linear-regressions-producing-multiple-outputs-tp3309411p3309411.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list