℡Wang Yan 2014-09-08 10:11 采纳率: 100%
浏览 2380
已采纳

我应该如何处理"包'xxx'不可用(对于 r 版本 x.y.z)"警告?

I tried to install a package, using

install.packages("foobarbaz")

but received the warning

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

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

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

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?
https://stackoverflow.com/questions/21580661/installing-predictabel-package-on-r-2-15-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)"
https://stackoverflow.com/questions/31439092/package-dplyr-is-not-available-for-r-version-3-1-1

转载于:https://stackoverflow.com/questions/25721884/how-should-i-deal-with-package-xxx-is-not-available-for-r-version-x-y-z-wa

  • 写回答

16条回答 默认 最新

  • local-host 2014-09-08 12:32
    关注

    1. You can't spell

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


    2. You didn't look in the right repository

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

    setRepositories()
    

    See also ?setRepositories.

    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.

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


    3. The package is not in the repositories you selected

    Return all the available packages using

    ap <- available.packages()
    

    See also Names of R's available packages, ?available.packages.

    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)
    

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

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

    Warning: unable to access index for repository
    

    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. You don't want a package

    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.

    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 or Bioconductor is out of date

    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"]
    

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

    library(installr)
    updateR()
    

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

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

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

    6. The package is out of date

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

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

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

    An alternative is to install from the github CRAN mirror.

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

    7. There is no Windows/OS X/Linux binary

    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).

    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")
    

    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. The package is on github/Bitbucket/Gitorious

    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")
    

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


    9. There is no source version of the package

    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")
    

    as described in this SO answer by imanuelc and the Details section of ?install.packages.


    10. The package is in a non-standard repository

    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 on the other hand isn't in a CRAN-like repository and has its own installation instructions.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(15条)

报告相同问题?

悬赏问题

  • ¥100 有人会搭建GPT-J-6B框架吗?有偿
  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名