How do I install a package that has been archived

2019-01-17 20:09发布

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.

3条回答
再贱就再见
2楼-- · 2019-01-17 20:50

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

查看更多
唯我独甜
3楼-- · 2019-01-17 20:54

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')\""
查看更多
Ridiculous、
4楼-- · 2019-01-17 21:01

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)

# Install dependencies

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.

查看更多
登录 后发表回答