I am new to R and I would love some assistance on this. I am using this dataset: https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-01-29/clean_cheese.csv
I am trying to first find the Average of the following Cheeses: Cheddar, American, Mozzarella, Italian, Swiss, Muenster, and Blue. Then I would like to place them into a line graph but show them all at once. I would like to show the average consumption of these cheeses.
The following is my code and what I have so far. I am new at this so this might like horrible to some.
line_3 <- clean_cheese %>%
select(c(Year, Cheddar, Mozzarella, `American Other`, `Italian other`, Swiss, Muenster, Blue)) %>%
group_by(Year) %>%
summarise(avg_cheddar_cheese = mean(Cheddar), avg_mozz_cheese = mean(Mozzarella), avg_american_other = mean(`American Other`), avg_italin_other = mean(`Italian other`), avg_swiss_cheese = mean(Swiss), avg_muenster = mean(Muenster), avg_blue = mean(Blue)) %>%
pivot_longer(-c(Year)) +
ggplot(aes(x = Year, y = value, color=name,group=name)) +
geom_line() +
facet_wrap(.~name,scales = 'free_y')
ggplotly(line_3)