top_packages_script.R 720 B

1234567891011121314151617
  1. # Script for calculating most downloaded packages in 2016
  2. # Uses functions from installr by Tal Galili
  3. # Functions sourced independently as installr does not install on Mac OS
  4. file.name.from.url <- function(URL) {
  5. basename(URL)
  6. }
  7. require2 <- require2
  8. source("RStudio_CRAN_data.R")
  9. RStudio_CRAN_data_folder <- download_RStudio_CRAN_data(START = as.Date("2016-01-01"))
  10. my_RStudio_CRAN_data <- read_RStudio_CRAN_data(RStudio_CRAN_data_folder)
  11. my_RStudio_CRAN_data <- format_RStudio_CRAN_data(my_RStudio_CRAN_data)
  12. packages <- most_downloaded_packages(my_RStudio_CRAN_data, n = 100L)
  13. top_2016 <- dplyr::data_frame(packages = names(packages), downloads = packages)
  14. write.csv(top_2016, "top_downloads_2016/top_packages")