R Package Automated Download
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.
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.