gpt4 book ai didi

r - R fpc包的安装

转载 作者:行者123 更新时间:2023-12-02 08:12:54 39 4
gpt4 key购买 nike

我在尝试将 R 中的“fpc”包安装在 Ubuntu 13.04 上时遇到了特别困难。

我编写的代码包含这样一行:

install.packages('fpc') ; library(fpc)

给出输出:

Error in contrib.url(repos, type) : 
trying to use CRAN without setting a mirror
Calls: install.packages -> grep -> contrib.url
Execution halted

我还没有搞乱 .Rprofile 文件,谷歌搜索这个问题表明这可能是原因( https://stat.ethz.ch/pipermail/r-devel/2009-October/055136.html ) - 这里的响应非常神秘(我从这个链接中了解到的是我可能没有设置镜子)。

无论如何,我已经从 apt-get 下载了所有软件包:

sudo apt-get install r-cran-*

到目前为止还没有解决这个问题。有什么建议吗??

谢谢!

最佳答案

如果您执行help(install.packages),您可以了解如何在调用本身中设置 CRAN 站点。但无论如何,我在我的 ~/.Rprofile

中使用了这一行
## Default repo
local({r <- getOption("repos");
r["CRAN"] <- "http://cran.r-project.org"; options(repos=r)})

为了格式化,我在这里将其分成两行。根据需要调整本地镜像。

关于r - R fpc包的安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16826933/

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