attach('~/meetings_workshops/data/treemass.rdata') attach('~/meetings_workshops/Rmodelingdata/treemass.rdata') attach('~/meetings_workshops/Rmodeling/data/treemass.rdata') detach(2) attach('~/meetings_workshops/Rmodeling/data/treemass.rdata') search() options(width=60) search() options(width=80) search() options(width=100) search() options(width=120) search() options(width=110) search() detach(2) attach('~/meetings_workshops/Rmodeling/data/treemass.rdata') search() ls(2) head(treemass) str(treemass) treemass$dbh options(width=100) treemass$dbh options(width=80) treemass$dbh str(treemass) summary(treemass$dbh) sd(treemass$dbh) summary(treemass) plot(treemass$dbh,treemass$ht) plot(ht~dbh,data=treemass) str(treemass) table(ForestType) table(treemass$ForestType) table(treemass$DryMonths) table(treemass$DryMonths,treemass$ForestType) plot(treemass$dbh,treemass$ht) mean(treemass$dbh) sd(treemass$dbh) var(treemass$dbh) log(treemass$dbh) mean(log(treemass$dbh)) mean(treemass$dbh) mean(log(treemass$dbh)) mean(sin(treemass$dbh)) log(10) plot(log(treemass$dbh),log(treemass$ht)) plot(treemass$dbh,treemass$ht) plot(log(treemass$dbh),log(treemass$ht)) par(mfcol=c(2,1)) plot(treemass$dbh,treemass$ht) plot(log(treemass$dbh),log(treemass$ht)) plot(log(ht)~log(dbh),data=treemass) graphics.off() plot(log(ht)~log(dbh),data=treemass) plot(treemass$dbh,treemass$ht) plot(treemass$dbh,treemass$ht,log='xy') plot(log(ht)~log(dbh),data=treemass) plot(treemass$dbh,treemass$ht,log='xy') plot(treemass$dbh,treemass$ht,log='x') plot(treemass$dbh,treemass$ht,log='y') plot(log(ht)~log(dbh),data=treemass) lm(log(ht)~log(dbh),data=treemass) htvsdbh=lm(log(ht)~log(dbh),data=treemass) summary(htvsdbh) abline(htvsdbh) plot(log(ht)~log(dbh),data=treemass,xlim=c(0,6)) abline(htvsdbh) abline(v=0) abline(h=1.158105) summary(lm(log(ht)~log(dbh),data=treemass)) summary(lm(log(ht)~log(dbh),data=treemass))$r.squard summary(lm(log(ht)~log(dbh),data=treemass))$r.squared summary(lm(log(ht)~log(dbh),data=treemass))$coefficients names(lm(log(ht)~log(dbh),data=treemass)) names(summary(lm(log(ht)~log(dbh),data=treemass))) summary(lm(log(ht)~log(dbh),data=treemass))$r.squared summary(lm((ht)~(dbh),data=treemass))$r.squared summary(lm((ht)~(dbh),data=treemass)) summary(lm(log(ht)~log(dbh),data=treemass)) plot((ht)~(dbh),data=treemass) abline(lm((ht)~(dbh),data=treemass)) abline(lm((ht)~(rainfall),data=treemass)) head(treemass) abline(lm((ht)~(Rainfall),data=treemass)) plot((ht)~(Rainfall),data=treemass) abline(lm((ht)~(Rainfall),data=treemass)) summary(lm((ht)~(Rainfall),data=treemass)) lm(log(agb)~log(dbh*ht),data=treemass) lm((agb)~(dbh*ht),data=treemass) lm(log(agb)~log(dbh*ht),data=treemass) lm(log(agb)~log(dbh*ht),data=treemass) lm((agb)~I(dbh*ht),data=treemass) plot((agb)~I(dbh*ht),data=treemass) ?I ?mean x11() dev.set(2) dev.set(3) ?I lm((agb)~(dbh*ht),data=treemass) lm((agb)~I(dbh*ht),data=treemass) treemass$dbhporht=treemass$dbh*treemass$ht summary(treemass) treemass$dbh[1] treemass$dht[1] treemass$ht[1] treemass$ht[2] lm((agb)~(dbhporht),data=treemass) lm((agb)~I(dbh*ht),data=treemass) lm((agb)~(dbh*ht),data=treemass) attach('/home/fullplotdata/stem/cerropeladocihhutp.stem1.rdata') attach('/home/fullplotdata/stem/cerropeladocihhutp.stem2.rdata') ls(2) cns2=cerropeladocihhutp.stem2 head(cns2) str(cns2) cns1=cerropeladocihhutp.stem1 sum(cns1$agb) sum(cns1$agb,na.rm=TRUE) sum(cns2$agb,na.rm=TRUE) hist(cns1$dbh,breaks=50) hist(cns2$dbh,breaks=50) subset(cns,dbh>=100)$agb subset(cns1,dbh>=100)$agb sum(subset(cns1,dbh>=100)$agb) sum(subset(cns2,dbh>=100)$agb) sum(subset(cns2,dbh<100)$agb) sum(subset(cns1,dbh<100)$agb) plot(cns1$agb,cns2$agb) plot(cns1$agb,cns2$agb,log='xy') abline(1,0) abline(0,1) abline(0,1,col='red') plot(cns2$agb-cns1$agb,cns2$agb) plot(cns1$agb,cns2$agb-cns1$agb) g=cns2$agb-cns1$agb summary(g) pera=cns1$sp=='peraar' points(cns1$agb[pera],g[pera],col='blue',pch=16) sum(g[pera]) sum(g[pera],na.rm=TRUE) sum(g[!pera],na.rm=TRUE) vata=cns1$sp=='vatade' sum(g[vata],na.rm=TRUE) vata=cns1$sp=='vantde' sum(g[vata],na.rm=TRUE) attach('/home/fullplotdata/stem/p22.stem2.rdata') attach('/home/fullplotdata/stem/p22.stem1.rdata') ls(2) sum(p22.stem1$agb,na.rm=TRUE) sum(p22.stem2$agb,na.rm=TRUE) table(cns2$status) subset(cns1,cns2$status=='D')$agb head(subset(cns1,cns2$status=='D')) sum(subset(cns1,cns2$status=='D')$agb) sum(g) sum(g,na.rm=TRUE) g=cns2$agb-cns1$agb length(unique(cns1$sp)) length(unique(cns2$sp)) unique(subset(cns2,status=='A')$sp) unique(subset(cns1,status=='A')$sp) tapply(cns1$agb,cns1$sp,sum,na.rm=TRUE) m2=tapply(cns2$agb,cns1$sp,sum,na.rm=TRUE) m1=tapply(cns1$agb,cns1$sp,sum,na.rm=TRUE) merge(m1,m2) m=match(names(m2),names(m1)) m1[] data.frame(m2,m1[m]) ?savehistory savehistory(file='/meetings_workshops/Rmodeling/CIHH/history/hist20Mar.txt') savehistory(file='~/meetings_workshops/Rmodeling/CIHH/history/hist20Mar.txt')