Im gonna be honest here, i dont know what any of that is, however, i believe my code is short and snappy? If you would still take a look at it in 'untidy format' will u please let me know? This is my problem, its the group_by() that seems to be the issue as it doesnt recognise one of my objects? Here is the code:
##Bar chart with Year
data <- read.csv("Giraffe_Data.csv", stringsAsFactors = FALSE)
Giraffes_summary2 <- filter(data, Habitat %in% c("Hill_slope", "Plateau")) %>%
group_by( Habitat, Year)
Giraffes_summary2 <- summarise(Giraffes_summary2, mean_Giraffe = mean(Herd_size),
sd_Giraffe = sd(Herd_size),
se_Giraffe = sd(Herd_size)/sqrt(n()))
ggplot(data = Giraffes_summary2,
mapping = aes(x = interaction(Habitat, Year), y = mean_Giraffe, fill = Habitat)) +
geom_col() +
geom_errorbar(aes(ymin = mean_Giraffe - sd_Giraffe,
ymax = mean_Giraffe + sd_Giraffe), width = 0.3)