Rainmaker
Rainmaker

Reputation: 1241

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

I typed the following in the R command line:

install.packages("RecordLinkage") 

I got the following error:

Warning in install.packages :
  package ‘RecordLinkage’ is not available (for R version 3.1.0)

However, one of my coworkers did the exact same thing on the exact same version of R (3.1.0) and it worked. In addition, I've managed to install other packages successfully.

Any idea why this does not work? Any help would be greatly appreciated.

Upvotes: 54

Views: 58281

Answers (4)

Andrie
Andrie

Reputation: 179388

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.

Upvotes: 53

Alex Thomas
Alex Thomas

Reputation: 1232

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

Upvotes: 26

Jiangtang Hu
Jiangtang Hu

Reputation: 127

If using Rstudio, select "install from Package Archive File(.zip;.tar.gz)" in "Install Packages" window.

Upvotes: 13

Carl Boneri
Carl Boneri

Reputation: 2722

On linux this is simply:

sudo su - -c "R -e \"devtools::install_url('https://cran.r-project.org/src/contrib/RecordLinkage_0.4-10.tar.gz')\""

Upvotes: 5

Related Questions