Created
December 25, 2016 20:33
-
-
Save yeedle/9ccbfa6fb49b8dae24f0daee549b4df9 to your computer and use it in GitHub Desktop.
How to download an R package and all its dependecies for windows
This file contains 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
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