R Package Automated Download

March 6, 2011
By

(This article was first published on Software for Exploratory Data Analysis and Statistical Modelling, and kindly contributed to R-bloggers)

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 his blog: Software for Exploratory Data Analysis and Statistical Modelling.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: , , , , , , ,

Comments are closed.