This is my data set:
Year Area s mean sd se
1 2004 Gootebank 9 0.2158556 0.1188472 0.03961573
2 2004 Thornton 4 1.9564700 1.9369257 0.96846283
3 2017 Gootebank 13 1.0664641 1.7131108 0.47513144
4 2017 Thornton 10 1.9384720 2.3308575 0.73708186
5 2018 Gootebank 13 1.4408562 1.6793808 0.46577643
6 2018 Thornton 10 1.8738613 3.0972972 0.97945136
I am trying to make a grouped boxplot that presents the mean values shown, in the table for each sandbank, for each year (which is 2004, 2017 and 2018 here). So should be a simple grouped boxplot. Im new with ggplot2 and can't find a way to make R separate each year in the plot
R seems to take the years together. I tried filling 'Area' as a factor but I can't seem to change it.
(incomplete) code up until now:
Sdata_autumnwinter <- ddply(epi_diverse_autumnwinter, c("Year", "Area"), summarise,
s = length(TOTALB),
mean = mean(TOTALB),
sd = sd(TOTALB),
se = sd / sqrt(s)
)
p <- ggplot(Sdata_autumnwinter, aes(x=Year, y=mean, fill= factor(Area))) +
geom_boxplot() + scale_x_discrete()+theme_bw()+ scale_y_continuous(limits=c(0, 3)) + labs(fill = "Area")
p