Skip to content

Instantly share code, notes, and snippets.

@revodavid
Last active March 23, 2018 16:24
Show Gist options
  • Save revodavid/8b473aa786ff1443362935c5725f35a0 to your computer and use it in GitHub Desktop.
Save revodavid/8b473aa786ff1443362935c5725f35a0 to your computer and use it in GitHub Desktop.
library(tidyverse)
library(stringr)
library(stringi)
simplify_name <- function(n)
## Extract just the name, removing any quotes, and normalize accented characters
stri_trans_general(str_trim(str_match(n,"^[\'\"]?([^\'\",(<]+).*<")[,2]),"latin-ascii")
pkglist <- tools::CRAN_package_db()
pkglist <- tbl_df(pkglist[-40]) ## remove duplicate MD5sum column
pkglist %>%
select(Maintainer, Author, Package) %>%
arrange(Maintainer) -> authors
authors %>%
transmute(Maint = simplify_name(Maintainer)) %>%
group_by(Maint) %>%
tally %>% arrange(desc(n)) -> topauthors
as.data.frame(head(topauthors,20))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment