跳转到内容
GitHub

配置 CRAN

通过 options(repos) 让 R 的 install.packages 经过 Depsilo /cran/ 路由。

之前https://cloud.r-project.org
之后http://localhost:23333/cran/

R 通过 options(repos) 指定 CRAN 镜像;把它写进 .Rprofile 可以让交互式会话和脚本都生效。

~/.Rprofile
options(repos = c(CRAN = "http://localhost:23333/cran/"))

也可以在单次会话中临时设置,用于验证:

options(repos = c(CRAN = "http://localhost:23333/cran/"))
install.packages("jsonlite")
  1. 确认实例就绪

    终端窗口
    curl -fsS http://localhost:23333/ready
  2. 安装一个包

    install.packages("jsonlite")
  3. 在 Admin 中确认流量

    在 Access logs 中核对 /cran/ 请求与缓存结果。