如何安装已从CRAN归档的软件包?

时间:2023-01-12 19:52:41

I typed the following in the R command line:

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

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.

但是,我的一个同事在完全相同的R(3.1.0)版本上做了完全相同的事情并且它起作用了。此外,我已成功安装其他软件包。

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

知道为什么这不起作用吗?任何帮助将不胜感激。

3 个解决方案

#1


22  

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:

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

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:

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

[   ]   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.

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

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.

这仅在您的计算机上安装了构建工具时才有效。在Linux上就是这种情况。但是在Windows上,如果你还没有安装RTools,你将不得不安装它。在OS X(Mac)上,您必须安装XCode和相关的命令行工具。

#2


1  

On linux this is simply:

在linux上这简单地说:

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

#3


0  

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

如果使用Rstudio,请在“安装包”窗口中选择“从包存档文件安装(.zip; .tar.gz)”。

#1


22  

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:

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

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:

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

[   ]   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.

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

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.

这仅在您的计算机上安装了构建工具时才有效。在Linux上就是这种情况。但是在Windows上,如果你还没有安装RTools,你将不得不安装它。在OS X(Mac)上,您必须安装XCode和相关的命令行工具。

#2


1  

On linux this is simply:

在linux上这简单地说:

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

#3


0  

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

如果使用Rstudio,请在“安装包”窗口中选择“从包存档文件安装(.zip; .tar.gz)”。