Skip to content

Instantly share code, notes, and snippets.

@toyeiei
Last active February 8, 2019 09:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toyeiei/d631be48082ee89ae36148c531efcc75 to your computer and use it in GitHub Desktop.
Save toyeiei/d631be48082ee89ae36148c531efcc75 to your computer and use it in GitHub Desktop.
# package ggplot2
install.packages("ggplot2")
library(ggplot2)
# create bar plot
small_page %>%
group_by(type) %>%
summarise(avg_like = mean(like)) %>%
arrange(desc(avg_like)) %>%
ggplot(aes(x = reorder(type, avg_like), y = avg_like)) +
geom_col(fill = "#3b5998") +
theme_minimal() +
labs(title = "Most popular content on DataRockie",
x = "content type",
y = "average like per post",
subtitle = "Photo posts received most averrage likes, followed by video and link respectively",
caption = "source: DataRockie FB Page")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment