R Package Automated Download

[This article was first published on Software for Exploratory Data Analysis and Statistical Modelling, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

There are situations where we might want to run R on a standalone machine so need to download a (potentially) large number of packages to install on this system. Rather than having to through the pain of searching through CRAN to find the packages and all the dependencies and manually download, it would be nice to be able grab all available packages in one go and then set them up as a local repository.

There are some functions provided in R that could take away some of the pain. After setting our default repository we can use the available.packages function to generate a list of available packages (no surprise there) and then use the download.packages function to download them to a suitable directory on our PC.

> pkg.list = available.packages()
> download.packages(pkgs = pkg.list, destdir = "C:\\MyRPackages")

This will grab the list of available packages and download them to the directory C:\MyRPackages so that they can be installed as required or burnt to CD/DVD and transferred to the standalone PC.

To leave a comment for the author, please follow the link and comment on their blog: Software for Exploratory Data Analysis and Statistical Modelling.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)