48

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.

zx8754
  • 52,746
  • 12
  • 114
  • 209
Rainmaker
  • 1,181
  • 2
  • 11
  • 11
  • If you point your browser to http://cran.r-project.org/web/packages/RecordLinkage/index.html you will notice the package was archived from CRAN, so you will have to install from an archived version. – Andrie Jun 12 '14 at 21:49
  • The package appears to no longer be available on CRAN: see http://cran.r-project.org/web/packages/RecordLinkage/index.html. I suppose it's possible it might still be on some CRAN mirrors. If your coworker just installed it, compare `getOption("repos")` values between the two sessions. Try to install if from the repo she used if possible. – MrFlick Jun 12 '14 at 21:51
  • Related: http://stackoverflow.com/questions/9161534/r-packages-in-archive – Andrie Jun 12 '14 at 22:29

4 Answers4

52

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.

IRTFM
  • 258,963
  • 21
  • 364
  • 487
Andrie
  • 176,377
  • 47
  • 447
  • 496
  • The build tools on OS X do require some installation (XCode, and the associated command line tools). – joran Jun 12 '14 at 22:30
  • 11
    if you have the compilation tools you may also be able to use `devtools::install_version("RecordLinkage",version="0.4-1")` as a shortcut. – Ben Bolker Jun 12 '14 at 23:54
  • Thanks so much for the help everyone! @Andrie I copied and pasted your code into RStudio and it worked perfectly (but I had to download a few other packages that RecordLinkage depends on first). – Rainmaker Jun 13 '14 at 00:37
  • See also http://stackoverflow.com/questions/18655976/how-to-install-the-package-that-has-been-removed-from-the-cran-repository-in-r-e for a one-lin answer similar to Ben Bolker's. – puslet88 Sep 25 '15 at 10:57
  • May I suggest `https` instead of `http`? (maybe it wasn't available at the time of this answer, now it is) – Aurèle Aug 24 '17 at 15:12
22

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

Alex Thomas
  • 1,142
  • 1
  • 11
  • 13
13

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

Jiangtang Hu
  • 127
  • 1
  • 3
4

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')\""
Carl Boneri
  • 2,632
  • 1
  • 13
  • 15