我应该如何处理“软件包'xxx'不可用(对于R版本x.y.z)",警告? [英] How should I deal with "package 'xxx' is not available (for R version x.y.z)" warning?

查看:128
本文介绍了我应该如何处理“软件包'xxx'不可用(对于R版本x.y.z)",警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用来安装软件包

I tried to install a package, using

install.packages("foobarbaz")

但收到警告

Warning message:
package 'foobarbaz' is not available (for R version x.y.z)

为什么R认为该软件包不可用?

Why doesn't R think that the package is available?

另请参阅以下有关此问题的特定实例的问题:

See also these questions referring to specific instances of this problem:

我的软件包不适用于R 2.15.2
软件包'Rbbg'不可用(对于R版本2.15.2)
包不可用(对于R版本2.15.2)
软件包doMC不可用install.packages中的R 3.0.0版警告
依赖性'Rglpk'不适用于软件包'fPortfolio'
打包时的处理方法不适用于我们的R版本吗?
是bigvis软件包for R不适用于R版本3.0.1?
package'syncwave'/'mvcwt'不可用(对于R版本3.0.2)
程序包"diamonds"不可用(对于R版本3.0.0)
是plyr软件包for R不适用于R版本3.0.2?
未在R 64 3.0.2上安装软件包bigmemory
程序包"makeR"不可用(对于3.0.2版)
程序包"RTN"不可用(对于R版本3.0.1)
无法安装geoR软件包
软件包'twitterR'不可用(对于R版本3.1.0)
如何安装"Rcpp软件包?我收到软件包不可用"
软件包数据集"不可用(对于R版本3.1.1)
"软件包"rhipe"不可用(对于R版本3.1.2)""

My package doesn't work for R 2.15.2
package 'Rbbg' is not available (for R version 2.15.2)
package is not available (for R version 2.15.2)
package doMC NOT available for R version 3.0.0 warning in install.packages
Dependency ‘Rglpk’ is not available for package ‘fPortfolio’
What to do when a package is not available for our R version?
Is the bigvis package for R not available for R version 3.0.1?
package ‘syncwave’/‘mvcwt’ is not available (for R version 3.0.2)
package ‘diamonds’ is not available (for R version 3.0.0)
Is the plyr package for R not available for R version 3.0.2?
Package bigmemory not installing on R 64 3.0.2
package "makeR" is not available (for version 3.0.2)
package ‘RTN’ is not available (for R version 3.0.1)
Trouble Installing geoR package
package ‘twitterR’ is not available (for R version 3.1.0)
How to install 'Rcpp, package? I got "package is not available"
package ‘dataset’ is not available (for R version 3.1.1)
"package ‘rhipe’ is not available (for R version 3.1.2)"

推荐答案

1.您不能拼写

要测试的第一件事是您是否正确拼写了程序包名称?程序包名称在R中区分大小写.

The first thing to test is have you spelled the name of the package correctly? Package names are case sensitive in R.

2.您没有找到正确的存储库

接下来,您应该检查该软件包是否可用.输入

Next, you should check to see if the package is available. Type

setRepositories()

另请参见?setRepositories .

要查看R将在哪个存储库中查找您的软件包,并可以选择选择其他存储库.至少,通常您会希望选择CRAN,如果您使用Windows,则通常选择CRAN (extras),如果要进行 [gen/prote/metabol/transcript] omics,则通常希望选择Bioc*存储库生物学分析.

To see which repositories R will look in for your package, and optionally select some additional ones. At the very least, you will usually want CRAN to be selected, and CRAN (extras) if you use Windows, and the Bioc* repositories if you do any [gen/prote/metabol/transcript]omics biological analyses.

要永久更改此设置,请在 Rprofile.site 文件.

To permanently change this, add a line like setRepositories(ind = c(1:6, 8)) to your Rprofile.site file.

3.该软件包不在您选择的存储库中

使用返回所有可用的软件包

Return all the available packages using

ap <- available.packages()

另请参见 R的可用软件包的名称由于这是一个大矩阵,因此您可能希望使用数据查看器对其进行检查.另外,您可以通过对行名进行测试来快速检查该程序包是否可用.

Since this is a large matrix, you may wish to use the data viewer to examine it. Alternatively, you can quickly check to see if the package is available by testing against the row names.

View(ap)
"foobarbaz" %in% rownames(ap)

或者,可以在浏览器中查看 CRAN CRAN(附加)生物导体 RForge ,和 github .

Alternatively, the list of available packages can be seen in a browser for CRAN, CRAN (extras), Bioconductor, R-forge, RForge, and github.

与CRA​​N镜像进行交互时,您可能还会收到的另一条警告消息是:

Another possible warnings message you may get when interacting with CRAN mirrors is:

Warning: unable to access index for repository

这可能表明所选的CRAN存储库当前不可用.您可以使用chooseCRANmirror()选择其他镜像,然后重试安装.

Which may indicate the selected CRAN repository is currently be unavailable. You can select a different mirror with chooseCRANmirror() and try the installation again.

有几个原因可能导致软件包不可用.

There are several reasons why a package may not be available.

4.您不需要包裹

也许您并不是真的想要一个包裹.对于

Perhaps you don't really want a package. It is common to be confused about the difference between a package and a library, or a package and a dataset.

包装是扩展R的材料的标准集合,例如提供代码,数据或文档.库是R知道找到它可以使用的程序包的地方(目录)

A package is a standardized collection of material extending R, e.g. providing code, data, or documentation. A library is a place (directory) where R knows to find packages it can use

要查看可用的数据集,请输入

To see available datasets, type

data()


5. R或生物导体已过期

它可能依赖于R的最新版本(或它导入/依赖的软件包之一).看

It may have a dependency on a more recent version of R (or one of the packages that it imports/depends upon does). Look at

ap["foobarbaz", "Depends"]

,并考虑将您的R安装更新到当前版本.在Windows上,最简单的方法是通过 installr 包.

and consider updating your R installation to the current version. On Windows, this is most easily done via the installr package.

library(installr)
updateR()

(当然,您可能需要先install.packages("installr").)

(Of course, you may need to install.packages("installr") first.)

等效于Bioconductor软件包,您可能需要更新Bioconductor安装.

Equivalently for Bioconductor packages, you may need to update your Bioconductor installation.

source("http://bioconductor.org/biocLite.R")
biocLite("BiocUpgrade")


6.该软件包已过期

可能已已存档(如果不再对其进行维护和不再通过 R CMD check 测试).

It may have been archived (if it is no longer maintained and no longer passes R CMD check tests).

在这种情况下,您可以使用 install_version()

In this case, you can load an old version of the package using install_version()

library(remotes)
install_version("foobarbaz", "0.1.2")

另一种方法是从github CRAN镜像安装.

An alternative is to install from the github CRAN mirror.

library(remotes)
install_github("cran/foobarbaz")


7.没有Windows/OS X/Linux二进制文件

由于需要,它可能没有 Windows二进制文件 CRAN没有的其他软件.此外,某些软件包仅可通过某些或所有平台的来源获得.在这种情况下,CRAN (extras)存储库中可能有一个版本(请参见上面的setRepositories).

It may not have a Windows binary due to requiring additional software that CRAN does not have. Additionally, some packages are available only via the sources for some or all platforms. In this case, there may be a version in the CRAN (extras) repository (see setRepositories above).

如果软件包需要编译代码(例如C,C ++,FORTRAN),则在Windows上安装 Rtools 或在OS X上安装XCode随附的开发人员工具,然后通过:

If the package requires compiling code (e.g. C, C++, FORTRAN) then on Windows install Rtools or on OS X install the developer tools accompanying XCode, and install the source version of the package via:

install.packages("foobarbaz", type = "source")

# Or equivalently, for Bioconductor packages:
source("http://bioconductor.org/biocLite.R")
biocLite("foobarbaz", type = "source")

在CRAN上,您可以通过查看描述中的NeedsCompilation标志来判断是否需要特殊的工具来从源代码构建软件包.

On CRAN, you can tell if you'll need special tools to build the package from source by looking at the NeedsCompilation flag in the description.

8.该软件包位于github/Bitbucket/Gitorious

它可能在Github/Bitbucket/Gitorious上有一个存储库.这些软件包需要安装 remotes 软件包.

It may have a repository on Github/Bitbucket/Gitorious. These packages require the remotes package to install.

library(remotes)
install_github("packageauthor/foobarbaz")
install_bitbucket("packageauthor/foobarbaz")
install_gitorious("packageauthor/foobarbaz")

(与installr一样,您可能需要先install.packages("remotes").)

(As with installr, you may need to install.packages("remotes") first.)

9.没有该软件包的源版本

尽管软件包的二进制版本可用,但源版本不可用.您可以通过设置关闭此检查

Although the binary version of your package is available, the source version is not. You can turn off this check by setting

options(install.packages.check.source = "no")

imanuelc的此SO答案 10.该软件包位于非标准存储库中

您的软件包位于非标准存储库中(例如

Your package is in a non-standard repository (e.g. Rbbg). Assuming that it is reasonably compliant with CRAN standards, you can still download it using install.packages; you just have to specify the repository URL.

install.packages("Rbbg", repos = "http://r.findata.org")

另一方面,

RHIPE 不在类似CRAN的存储库中,而是具有自己的安装说明.

这篇关于我应该如何处理“软件包'xxx'不可用(对于R版本x.y.z)",警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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