-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathIntro2.R
25 lines (18 loc) · 830 Bytes
/
Intro2.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
X=read.table('ChlorellaGrowth.txt',header=T)
X=as.matrix(X)
Light=X[,1]
rmax=X[,2]
par(cex=1.5,cex.main=0.9)
plot(Light,rmax,xlab="Light intensity (uE/m2/s)", ylab="Maximum growth rate rmax (1/d)",pch=16)
# xlab and ylab are x and y axis labels, pch is "plotting character"
# cex is 'character expansion' - cex=1.5 increases symbol & label sizes by 50%
# cex.main sets the character expansion for the main title of the plot
title(main="Data from Fussmann et al. (2000) system")
fit=lm(rmax~Light)
summary(fit); abline(fit)
# Next we get the regression equation to 'display itself' on the graph
c1=round(fit$coef[1],digits=3) # intercept
c2=round(fit$coef[2],digits=3) # slope
text(50,3,paste("rmax=",c1,"+",c2,"Light"))
# You can use ?round, ?text and ?paste to read about these commands
# for working with plots