-
Notifications
You must be signed in to change notification settings - Fork 0
/
TreeMortalitySupplement.R
35 lines (28 loc) · 1.09 KB
/
TreeMortalitySupplement.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#Tree mortality in the BFEC Forest
#Nina Hamilton and Drew Kerkhoff
#construct a plot of mortality rate vs. plant size, from 2006 to 2011
#Plant Size Distribution Project
#Dillon et al.
#Drew Kerkhoff 2018
#Assumes you have already read in all of the plot data using `1.ReadData.R`
require(ggplot2)
require(dplyr)
require(tidyr)
# Bin the data by log DBH in 2006 then calculate annualized mortality rate in each size class
TreeDeath = BFECTreeMortality %>%
mutate(SizeClass = cut(logDBH1, breaks=seq(0,2.1,0.1), labels=seq(0.05,2.1,0.1),
include.lowest=TRUE),
SizeClass = as.numeric(as.character(SizeClass))) %>%
group_by(Status, SizeClass) %>%
summarise(n = n()) %>%
spread(Status, n) %>%
mutate(AnnMortRate = dead/(alive+dead)/5)
#plot annualized mortality as a function of size class
pdf("Figures/MortRateBFEC.pdf", height=5, width=5)
par(cex=1.25, cex.axis=1.1, cex.lab=1.5, lwd=2.5)
ggplot(TreeDeath,aes(x=SizeClass,y=AnnMortRate)) +
geom_point() +
geom_smooth() +
labs(x="log(DBH)", y="Annualized mortality rate")+
theme_bw(base_size=12)
dev.off()