如何安装从CRAN存档的软件包? [英] How do I install a package that has been archived from CRAN?

查看:216
本文介绍了如何安装从CRAN存档的软件包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在R命令行中键入了以下内容:

I typed the following in the R command line:

install.packages("RecordLinkage") 

我遇到以下错误:

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

但是,我的一位同事对R(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.

推荐答案

该软件包已存档,因此您必须从存档中进行安装.

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

我知道这一点是因为位于 http://cran的软件包主页.r-project.org/web/packages/RecordLinkage/index.html 告诉我:

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.

通过链接到归档文件( http://cran.r-project .org/src/contrib/Archive/RecordLinkage ),我会得到所有旧版本的列表:

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     

所以现在我知道了最新版本的版本号.前进的方法是下载tarball,安装所有程序包依赖项,然后从本地下载的文件中安装程序包.

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.

尝试一下:

# 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:

这仅在您的计算机上安装了构建工具时才有效.在Linux上会是这种情况.但是在Windows上,如果尚未安装RTools,则必须安装它.在OS X(Mac)上,您将必须安装XCode和相关的命令行工具.

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.

这篇关于如何安装从CRAN存档的软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆