MirrorZ Help

CRAN 镜像使用帮助

选择镜像

长期使用

CRAN (The Comprehensive R Archive Network) 镜像源配置文件之一是 ~/.Rprofile

注:R 的 ~ 在类 Unix 系统下为:$HOME(即 ~),在 Windows 下为:%USERPROFILE%\Documents,具体路径可以在 R 中执行 path.expand("~") 查看。

新建 .Rprofile 文件或在 R 中执行如下语句打开已有文件:

file.edit(file.path("~", ".Rprofile"))

在文末添加如下语句:

options("repos" = c(CRAN="https://(Loading...)/"))

之后即可使用该 CRAN 镜像源安装 R 软件包。

临时使用

在安装时指定 repo:

install.packages("lattice", repos="https://(Loading...)/")

Debian/Ubuntu 下添加 CRAN 镜像安装 R

参考如下链接中 README 里的步骤

# Debian 帮助
https://(Loading...)/bin/linux/debian/
# Ubuntu 帮助
https://(Loading...)/bin/linux/ubuntu/fullREADME.html

编辑 /etc/apt/sources.list.d/r-mirror.list

发行版
CRAN 版本号
deb https://(Loading...)/bin/linux/debian bullseye-cran40/

然后运行

# Debian 用户添加该公钥
gpg --keyserver keyserver.ubuntu.com --recv-key '95C0FAF38DB3CCAD0C080A7BDC78B2DDEABC47B7'
gpg --armor --export '95C0FAF38DB3CCAD0C080A7BDC78B2DDEABC47B7' | sudo  tee /etc/apt/trusted.gpg.d/cran_debian_key.asc
# Ubuntu 用户添加该公钥
wget -qO- https://(Loading...)/bin/linux/ubuntu/marutter_pubkey.asc | sudo  tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
# 更新软件包
sudo apt-get update
sudo apt-get install r-base-dev

这个页面的内容有问题?在 GitHub Issue 反馈

想完善这个页面?查看我们的贡献指南在 GitHub 上查看此页的源代码

本页面的全部内容在 CC BY-NC-SA 4.0 协议之条款下提供,附加条款亦可能应用。