I'm trying to make a grouped bar plot. Not sure if my spreadsheet is set up right. I've got three columns: Dates, Cases, Org. The chart should show two repeating bars on the X axis for each day in September, one for Org1 and one for Org 2. The Y axis should be the daily # of COVID-19 cases. Not sure where I went wrong, but thanks for any help. I'm new to R.
Chico_Butte_Plot_df <- Butte_ChicoState_COVID %>%
filter (D >= as.Date("2020-09-01") & D <= as.Date("2020-09-13"))
select(D, Cases, Org) %>%
spread(Org, Cases) %>%
mutate(gap = `Butte` - `ChicoState`) %>%
arrange(desc(gap)) %>%
head(5)%>%
gather(key = Org, value = Cases) %>%
Chico_Butte_Plot <- ggplot(Chico_Butte_Plot_df, aes(x = D, y = Cases, fill = as.factor(Org))) +
geom_bar(stat="identity", position="dodge") +
geom_hline(yintercept = 0, size = 1, colour="#333333") +
bbc_style() +
scale_fill_manual(values = c("#1380A1", "#FAAB18")) +
labs(title="We're living longer",
subtitle = "Biggest life expectancy rise, 1967-2007")
Chico_Butte_Plot
I'm receiving this error:
Error: Insufficient values in manual scale. 3 needed but only 2 provided.