gpt4 book ai didi

r - install.packages 错误 : Troubleshooting local repo usage

转载 作者:行者123 更新时间:2023-12-04 10:45:17 25 4
gpt4 key购买 nike

我刚刚创建了一个包 ( RTIO ) 和一个包存储库 ( Q:/Integrated Planning/R ),这是一个公司网络驱动器。

我已将我的包裹放入文件夹中:
Q:/Integrated Planning/R/bin/windows/contrib/2.15/RTIO_0.1-2.zip
按照 Dirk 在 this 中的说明所以,我已经运行了以下命令:

> setwd("Q:/Integrated Planning/R/bin/windows/contrib/2.15")
> tools::write_PACKAGES(".", type="win.binary")
> list.files()
[1] "PACKAGES" "PACKAGES.gz" "RTIO_0.1-2.zip"
>

使用下面的代码,我已将本地存储库添加到我的存储库列表中(我将让其他用户也这样做):
options(repos = c(getOption("repos"), RioTintoIronOre = "Q:/Integrated Planning/R"))

现在尝试安装我的软件包时出现错误:
> install.packages("RTIO")
Installing package(s) into ‘C:/Program Files/R/R-2.15.1/library’
(as ‘lib’ is unspecified)
Warning in install.packages :
unable to access index for repository Q:/Integrated Planning/R/bin/windows/contrib/2.15
Warning in install.packages :
unable to access index for repository Q:/Integrated Planning/R/bin/windows/contrib/2.15
Warning in install.packages :
unable to access index for repository Q:/Integrated Planning/R/bin/windows/contrib/2.15
Warning in install.packages :
package ‘RTIO’ is not available (for R version 2.15.1)

什么 unable to access index for repository告诉我?我该如何解决?

我真正想做的是,在 Windows 和 RStudio 作为 IDE 的情况下,让其他内部 R 用户添加这个包存储库,以便他们能够运行像 install.packages("RTIO") 这样的命令。或 update.packages()获取包的新版本(并且大概还能够使用 IDE 通过 GUI 管理包)。

更新:

多亏了 agstudy 的回答,我又近了一步。这是我得到的输出。
> getOption("repos")
CRAN CRANextra
"http://cran.ms.unimelb.edu.au/" "http://www.stats.ox.ac.uk/pub/RWin"
> setRepositories(addURLs=c(RioTintoIronOre = "file://Q:/Integrated Planning/R"))
--- Please select repositories for use in this session ---


1: + CRAN
2: + CRAN (extras)
3: BioC software
4: BioC annotation
5: BioC experiment
6: BioC extra
7: Omegahat
8: R-Forge
9: rforge.net

Enter one or more numbers separated by spaces, or an empty line to cancel
1:
> getOption("repos")
RioTintoIronOre
"file://Q:/Integrated Planning/R"
> install.packages("RTIO")
Installing package(s) into ‘C:/Program Files/R/R-2.15.1/library’
(as ‘lib’ is unspecified)
Warning in install.packages :
cannot open compressed file '//Q:/Integrated Planning/R/bin/windows/contrib/2.15/PACKAGES', probable reason 'No such file or directory'
Error in install.packages : cannot open the connection

跟进问题:
  • 为什么在使用setRepositories()时提示选择仓库?
  • 当我在没有输入数字的情况下点击“回车”时,检查 getOption("repos")它只显示 File://Q:/Integrated Planning/R存储库。这是为什么?
  • 当我这样做时 install.packges("RTIO")它似乎找到了该文件,但给出了警告 cannot open compressed file和一个错误 cannot open the connection .注意 list.files() 的输出以上。知道为什么吗?
  • 最佳答案

    为了避免此消息:

    Warning in install.packages : cannot open compressed file '//Q:/Integrated Planning/R/bin/windows/contrib/2.15/PACKAGES', probable reason 'No such file or directory'

    试试这个删除 //setRepositories 中指定 url 时
    > setwd("Q:/Integrated Planning/R/bin/windows/contrib/2.15")
    > tools::write_PACKAGES(".", type="win.binary")
    > setRepositories(addURLs=c(RioTintoIronOre = "file:Q:/Integrated Planning/R"))
    > install.packages("RTIO")

    关于r - install.packages 错误 : Troubleshooting local repo usage,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13813924/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com