labeling-stats.R (995B)
1 # install.packages("dlstats") 2 library(dlstats) 3 library(ggplot2) 4 library(ggthemes) 5 6 cat("Fetching stats...\n") 7 x <- cran_stats(c("labeling")) 8 cat("Stats fetched.\n") 9 10 cat("Plotting stats\n") 11 if (!is.null(x)) { 12 head(x) 13 title = "Downloads through time for package labeling" 14 ggplot(x, aes(end, downloads)) + 15 geom_line() + 16 geom_point(aes(shape=package)) + 17 labs( 18 title="Downloads for R package 'labeling' through time", 19 subtitle="", 20 x="", 21 y="" 22 ) + 23 theme_tufte() + 24 theme( 25 legend.title = element_blank(), 26 plot.title = element_text(hjust = 0.5), 27 plot.subtitle = element_text(hjust = 0.5), 28 legend.position="none", 29 axis.text.x=element_text(angle=60, hjust=1), 30 plot.background=element_rect(fill = "white",colour = NA) 31 ) + 32 # scale_x_date(date_breaks = "1 year", date_labels = "%Y") + 33 scale_y_continuous(labels = scales::label_comma()) 34 } 35 36 cat("Saving plot\n") 37 ggsave("stats.png", width=6, height=4)