I am working on this assignment for school, and I cannot figure out why this code is coming back with an error
Code:
dev.new() #Mac users use dev.new()
justin.counts %>%
filter(Basketball == "Spalding Basketball") %>%
filter(n > 5) %>% #words should occur more than 5 times, you can change this number
group_by(Rating) %>%
ungroup() %>%
mutate(word = reorder(word, n)) %>%
head(50) %>% #limits total number of words to the top 60 words, you can change this number
ggplot(aes(word, n, fill=sentiment))+ #remove x and y
geom_col(show.legend = F)+
facet_wrap(~Rating, scales= "free_y")+
scale_fill_manual(values = alpha(c("#CDC8B1", "#ADD8E6"))) + #Important change the colors.
labs(y = "Spalding Basketball Contribution to Sentiment by Number of Stars",
x = NULL)+
**add text size code
**Important: Make sure you changed the labels
coord_flip() #Bing sentiment by number of stars
Error message:
Error in combine_vars():
! Faceting variables must have at least one value.
What does this error mean and how can I resolve it?
I am working on this assignment for school, and I cannot figure out why this code is coming back with an error Code: dev.new() #Mac users use dev.new() justin.counts %>% filter(Basketball == "Spalding Basketball") %>% filter(n > 5) %>% #words should occur more than 5 times, you can change this number group_by(Rating) %>% ungroup() %>% mutate(word = reorder(word, n)) %>% head(50) %>% #limits total number of words to the top 60 words, you can change this number ggplot(aes(word, n, fill=sentiment))+ #remove x and y geom_col(show.legend = F)+ facet_wrap(~Rating, scales= "free_y")+ scale_fill_manual(values = alpha(c("#CDC8B1", "#ADD8E6"))) + #Important change the colors. labs(y = "Spalding Basketball Contribution to Sentiment by Number of Stars", x = NULL)+
**add text size code
**Important: Make sure you changed the labels
coord_flip() #Bing sentiment by number of stars
Error message: Error in
combine_vars()
: ! Faceting variables must have at least one value.What does this error mean and how can I resolve it?
Thank you