Created
May 8, 2019 21:40
-
-
Save oganm/98a21812e3abb19b1a713f1f4f2d250a to your computer and use it in GitHub Desktop.
cranlogs package rank
This file contains hidden or 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(cranlogs) | |
library(dplyr) | |
allPackages = available.packages() %>% rownames | |
groups = cut(seq_along(allPackages), breaks = seq(0,length(allPackages),20)) %>% {.=as.character(.);.[is.na(.)]='last';factor(.,levels = unique(.))} | |
package_groups = split(allPackages,groups) | |
package_groups %>% lapply(function(x){ | |
x %>% cran_downloads('last-month') %>% group_by(package) %>% summarise(sum(count)) | |
}) %>% do.call(rbind,.) -> package_downloads | |
package_count = package_downloads %>% filter(package == 'ggplot2') %$% `sum(count)` | |
sum(package_downloads$`sum(count)`>package_count)/nrow(package_downloads) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment