3 de febrero de 2013

InstallOldPackages: a repmis command for installing old R package versions

(This article was first published on Christopher Gandrud (간드루드 크리스토파) , and kindly contributed to R-bloggers)

A big problem in reproducible research is that software changes. The code you used to do a piece of research may depend on a specific version of software that has since been changed. This is an annoying problem in R because install.packages only installs the most recent version of a package. It can be tedious to collect the old versions.


On Toby Dylan Hocking's suggestion, I added tools to the repmis package so that you can install, load, and cite specific R package versions. It should work for any package version that is stored on the CRAN archive (http://cran.r-project.org).


To only install old package versions use the new repmis command InstallOldPackages. For example:



# Install old versions of the e1071 and gtools packages.



# Create vectors of the package names and versions to install

# Note the names and version numbers must be in the same order

Names &lt- c("e1071", "gtools")

Vers &lt- c("1.6", "2.6.1")



# Install old package versions into the default library

InstallOldPackages(pkgs = Names, versions = Vers)


You can also now have LoadandCite install specific package versions:



# Install, load, and cite specific package versions



# Create vectors of the package names and versions to install

# Note the names and version numbers must be in the same order

Names &lt- c("e1071", "gtools")

Vers &lt- c("1.6", "2.6.1")



# Run LoadandCite

LoadandCite(pkgs = Names, versions = Vers, install = TRUE, file = "PackageCites.bib")


See this post for more details on LoadandCite.


Future


I intend to continue improving these capabilities. So please post any suggestions for improvement (or report any bugs) at on the GitHub issues page.



To leave a comment for the author, please follow the link and comment on his blog: Christopher Gandrud (간드루드 크리스토파) .



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,ecdf, trading) and more...





via Jonathan's starred items in Google Reader

No hay comentarios.:

Publicar un comentario

Comenta con Respeto. Y escribe claramente lo que deseas transmitir