#import bird data #libraries library(dplyr) library(tidyr) library(ggplot2) library(scales) library(ggpubr) #plot understory vs. BA ggplot(data=bird_HJAndrews, aes(x=Coniferous_BA, y=Under_per_cover)) + geom_point()+ labs(x="Coniferous Basal Area", y = "Understory Percent Cover")+ geom_smooth(method = "lm", se=FALSE, color="black", formula = y ~ x) #correlation (r2) between coniferous basal area and understory percent cover cor(bird_HJAndrews$Coniferous_BA, bird_HJAndrews$Under_per_cover) #plot understory vs. Num of Warblers ggplot(data=bird_HJAndrews, aes(x=Under_per_cover, y=NumIndiv, colour = Species)) + geom_point(aes(color = factor(Species)))+ labs(x="Understory Percent Cover", y = "Number of Warblers (one year average)")+ geom_smooth(method = "lm", se=FALSE, formula = y~x, linetype = "dashed") #plot understory vs. Num of Warblers ggplot(data=bird_HJAndrews, aes(x=Coniferous_BA, y=NumIndiv, color = Species)) + geom_point(aes(color = factor(Species)))+ labs(x="Coniferous Basal Area", y = "Number of Warblers (one year average)")+ geom_smooth(method = "lm", se=FALSE, formula = y~x, linetype = "dashed") #HEWA data HEWA = bird_HJAndrews %>% select(Species, NumIndiv, Under_per_cover, Coniferous_BA) %>% filter(Species == "HEWA") HEWA HEWA_reg1 = lm(NumIndiv ~ Under_per_cover, data=HEWA) summary(HEWA_reg1) HEWA_reg2 = lm(NumIndiv ~ Coniferous_BA, data=HEWA) summary(HEWA_reg2) #WIWA data WIWA = bird_HJAndrews %>% select(Species, NumIndiv, Under_per_cover, Coniferous_BA) %>% filter(Species == "WIWA") WIWA WIWA_reg1 = lm(NumIndiv ~ Under_per_cover, data=WIWA) summary(WIWA_reg1) WIWA_reg2 = lm(NumIndiv ~ Coniferous_BA, data=WIWA) summary(WIWA_reg2)