Skip to content

Instantly share code, notes, and snippets.

@yeedle
Created December 25, 2016 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yeedle/9ccbfa6fb49b8dae24f0daee549b4df9 to your computer and use it in GitHub Desktop.
Save yeedle/9ccbfa6fb49b8dae24f0daee549b4df9 to your computer and use it in GitHub Desktop.
How to download an R package and all its dependecies for windows
getPackages <- function(packs){
packages <- unlist(
tools::package_dependencies(packs, available.packages(),
which=c("Depends", "Imports"), recursive=TRUE)
)
packages <- union(packs, packages)
packages
}
packages <- getPackages(c("ggplot2", "MASS"))
download.packages(packages, destdir="PATH/TO/DOWNLOAD/LOCATION",
type="win.binary")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment