knitr::opts_chunk$set( echo = TRUE, comment = "#>", collapse = TRUE, warning = FALSE, message = FALSE, fig.width = 10, fig.height = 8 )
library("rostats")
If you haven't downloaded data yet, get data:
Get Github commits
pkgs <- ropensci_pkgs() gather_commits(pkgs$owner_repo)
Get CRAN downloads
pkgs <- ropensci_pkgs(TRUE)$name gather_downloads(x = pkgs)
These both download to directories in rappdirs::user_cache_dir("rostats")
For the below plotting functions, you can pass a particular file name, just the
base name, not full path, or leave it as NULL
and it uses file with the
most recent date
Git commit history
cum_commits()
Cumulative number of contributors
cum_contribs()
These represent stable/mature enough packages to be delivered to the world.
library("dplyr") library("ggplot2") pkgs <- ropensci_pkgs(TRUE)$name res <- gather_crans(pkgs) alldat <- bind_rows(res) dates <- cran_first_date(alldat) # exclude geonames, was created before ropensci existed dates <- dates %>% filter(pkg != "geonames") # summarise dat <- dates %>% group_by(date) %>% summarise(count = n()) %>% mutate(cumsum = cumsum(count)) ggplot(dat, aes(date, cumsum)) + geom_line(size = 2) + theme_bw(base_size = 18) + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), legend.position = "none", axis.ticks.x = element_blank(), panel.border = element_rect(size = 2)) + labs(y = 'Cumulative New Packages on CRAN')
Via CRAN downloads stats collected from just one of the CRAN mirrors at https://cran.rstudio.com
library("ggplot2") cum_downloads() %+% facet_wrap(~package, scales = "free_y", ncol = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.