软件工程

给R语言RStudio添加阿里云镜像源

本文主要是介绍给R语言RStudio添加阿里云镜像源,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

方法一:

打开RStudio,输入options()$repos查看默认镜像源情况

options()$repos

file

打开tools工具栏,找到Global Options

file

找到Packages,点击右边的add

file

出现添加镜像源的对话框,name处填入aliyun,url填入:https://mirrors.aliyun.com/CRAN/, 点击ok保存

file

在命令栏输入options()$repos查看镜像源情况

file

方法二:

找到C盘,program files文件下,R/R-4.0.3/etc中的Rprofile文件

file

file

原来的:

# Things you might want to change
# options(papersize="a4")
# options(editor="notepad")
# options(pager="internal")
# set the default help type
# options(help_type="text")
  options(help_type="html")
# set a site library
# .Library.site <- file.path(chartr("\\", "/", R.home()), "site-library")
# set a CRAN mirror
# local({r <- getOption("repos")
#       r["CRAN"] <- "http://my.local.cran"
#       options(repos=r)})
# Give a fortune cookie, but only to interactive sessions
# (This would need the fortunes package to be installed.)
#  if (interactive()) 
#    fortunes::fortune()

修改后:

# set a CRAN mirror
local({r <- getOption("repos")
r["CRAN"] <- "https://mirrors.aliyun.com/CRAN/"
options(repos=r)})
这篇关于给R语言RStudio添加阿里云镜像源的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!