Last active
December 18, 2020 20:58
-
-
Save Ryo-N7/01a40cf3cedd4e54a068eb8916f357f5 to your computer and use it in GitHub Desktop.
top 10 most downloaded r packages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(tidyr) | |
library(ggplot2) | |
library(cranlogs) | |
library(ggtextures) # devtools::install_github("clauswilke/ggtextures") | |
library(extrafont) | |
loadfonts() | |
# top 10 package downloads from 9/29 to 10/28 from 'cranlogs' package | |
top_10_october <- cran_top_downloads(when = "last-month", count = 10) | |
top_10_october_images <- top_10_october %>% | |
mutate(image = c( | |
"https://raw.githubusercontent.com/tidyverse/tidyverse/master/man/figures/logo.png", | |
"https://raw.githubusercontent.com/isocpp/logos/master/cpp_logo.png", | |
"https://raw.githubusercontent.com/r-lib/rlang/master/man/figures/rlang.png", | |
"https://raw.githubusercontent.com/tidyverse/ggplot2/master/man/figures/logo.png", | |
"https://upload.wikimedia.org/wikipedia/en/1/1f/Spool_of_string.jpg", | |
"https://pixfeeds.com/images/16/421149/1200-498885446-digestive-system.jpg", | |
"https://raw.githubusercontent.com/tidyverse/glue/master/man/figures/logo.png", | |
"https://raw.githubusercontent.com/tidyverse/dplyr/master/man/figures/logo.png", | |
"https://i.imgur.com/JYv9NTF.jpg", | |
"https://raw.githubusercontent.com/tidyverse/stringr/master/man/figures/logo.png"), | |
count_lab = count %>% scales::comma) | |
# PLOT | |
ggplot(top_10_october_images, | |
aes(x = reorder(package, -count), y = count, | |
image = image)) + | |
geom_textured_col(img_width = unit(0.6, "null")) + | |
geom_text(aes(label = count_lab, family = "Roboto Condensed"), | |
size = 3.5, | |
nudge_y = 25000) + | |
scale_y_continuous(expand = c(0, 0), | |
limits = c(0, 1100000), | |
labels = scales::comma) + | |
labs(title = "Top 10 Most Downloaded R Packages in the Past Month", | |
subtitle = "from CRAN: Sept. 28, 2018 - Oct. 29, 2018", | |
x = "Package", y = "# of Times Downloaded") + | |
theme_minimal() + | |
theme(text = element_text(family = "Roboto Condensed"), | |
axis.text = element_text(size = 10), | |
axis.title = element_text(size = 12), | |
panel.grid.major.x = element_blank()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment