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

查看:25
本文介绍了如何安装已从 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)

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

这仅在您的机器上安装了构建工具时才有效.在 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天全站免登陆