My apologies for my ineptitude... it's been a while since I had my R stats class and I've been trying to figure this out all day. I'm having some difficulty including percentages on the bars in my plot. Is it possible to do so with the script I already have?
proj <- Master_List_for_R_Studio
#data prep
proj$Location <- as.factor(proj$Location)
head(proj, 3)
proj$Host <- as.factor(proj$Host)
head(proj,3)
#compute summary stats
proj.summary2 <- proj %>%
group_by(Location, Host) %>%
summarise(
std.error = std.error(prv_aspido),
prv_aspido = mean(prv_aspido)
)
proj.summary2
#plot
asp.ab3 <-ggplot(proj.summary2, aes(Location, prv_aspido)) +
geom_col(aes(fill = Host), position = position_dodge(0.8), width = 0.7) +
labs(y= "Aspido.sp Abundance") +
geom_errorbar(
aes(ymin = prv_aspido-std.error, ymax = prv_aspido+std.error, group = Host),
width = 0.2, position = position_dodge(0.8)
) +
scale_y_continuous(labels = scales::percent)
asp.ab3
With this script, I get the following plot, but I'd like to include percentages. I've also been referring to Sebastian Sauer