I'm trying to get standard errors added to a bar graph. I created a new data frame with standard error. Tried using dyplr but I think I had issues with plyr competing - got an error message:
(Error in sqrt (n): non-numeric argument to mathematical function dyplyr).
I did manage to get se into a data frame using the FSA package, but my error says the following:
Error in FUN (X[[I]], ...): object 'PZ_P3bDifference' not found
Here's my code:
require (FSA)
Sum = Summarize(PZ_P3bDifference ~ Session,
data=Desert)
Sum$se = Sum$sd / sqrt(Sum$n)
ggplot(Sum,
aes(x = Session,
y = PZ_P3bDifference)) +
geom_bar(stat = "identity",
color = "black",
position = position_dodge()) +
geom_errorbar(aes(ymin = mean - se,
ymax = mean + se),
width = 0.2,
size = 0.7,
position = position_dodge(),
color = "black")
This code was taken from the following page: https://rcompanion.org/handbook/C_04.html
I tried restarting R and uninstalling/reinstalling ggplot2 but no luck in getting this to run.