How do I install a package that has been archived from CRAN?

Solution 1:

The package has been archived, so you will have to install from an archive.

I know this because the package home page at http://cran.r-project.org/web/packages/RecordLinkage/index.html tells me:

Package ‘RecordLinkage’ was removed from the CRAN repository.

Formerly available versions can be obtained from the archive.

Archived on 2015-05-31 as memory access errors were not corrected.

By following the link to archives (http://cran.r-project.org/src/contrib/Archive/RecordLinkage) I get a list of all old versions:

[   ]   RecordLinkage_0.3-5.tar.gz  12-Sep-2011 18:04   688K     
[   ]   RecordLinkage_0.4-1.tar.gz  12-Jan-2012 09:39   676K     

So now I know the version number of the most recent version. The way forward is to download the tarball, install all package dependencies and then install the package from the local downloaded file.

Try this:

# Download package tarball from CRAN archive

url <- "http://cran.r-project.org/src/contrib/Archive/RecordLinkage/RecordLinkage_0.4-1.tar.gz"
pkgFile <- "RecordLinkage_0.4-1.tar.gz"
download.file(url = url, destfile = pkgFile)

# Expand the zip file using whatever system functions are preferred

# look at the DESCRIPTION file in the expanded package directory

# Install dependencies list in the DESCRIPTION file

install.packages(c("ada", "ipred", "evd"))

# Install package
install.packages(pkgs=pkgFile, type="source", repos=NULL)

# Delete package tarball
unlink(pkgFile)

Note:

This will only work if you have the build tools installed on your machine. On Linux this will be the case. But on Windows you will have to install RTools if you don't have it already. And on OS X (Mac) you will have to install XCode and the associated command line tools.

Solution 2:

Also this solution from the Rstudio blog

require(devtools)
install_version("ggplot2", version = "0.9.1", repos = "http://cran.us.r-project.org")

https://support.rstudio.com/hc/en-us/articles/219949047-Installing-older-versions-of-packages