参见:https://cloud.tencent.com/developer/article/1728636
简介
前段时间看群里的师兄发了一张图:
是骡子是马,咱拉出来溜溜:
安装非常简单,和一般的R 一样,只不过其没有提供mac os 版本(太损啦)。
使用
使用上和一般的R 感觉差不多,但上来就很爽:
设置核心数
两个函数,和parallel 包中的操作非常像:
getMKLthreads() # 查看线程
setMKLthreads(<value>) # 配置线程
镜像设置
发现和R open 在r studio 中设置镜像不同,mran R 的设置不起作用。
这里可以参考我的设置,直接在Rprofile 中配置即可:
file.edit(file.path(“~”, “.Rprofile”)) 进入文件
# start with welcome
.First <- function(){
message("Hello Peng!")
message(paste0("Welcome at ", date()))
# 配置install 命令使用的线程
n <- parallel::detectCores()
options(Ncpus = n-1)
n2 <- getOption("Ncpus", 1L)
message(paste0("We will use ", n2, " cores for installing.\n"))
}
# 配置镜像
r <- getOption( "repos" );# set CRAN mirror for users in China
r[ "CRAN" ] <- "https://mirrors.tuna.tsinghua.edu.cn/CRAN/"; # CRAN的镜像地址
options( repos = r )
BioC <- getOption( "BioC_mirror" ); # set bioconductor mirror for users in China
BioC[ "BioC_mirror" ] <- "https://mirrors.ustc.edu.cn/bioc/"; # bioconductor的镜像地址
options( BioC_mirror = BioC )
rm(r, BioC)
# finish with goodbye
.Last <- function(){
cat("\n Goodbye,", date(), "\n")
}
这样两个主要安装R 的来源都配置好了镜像了:
getOption( "repos" )
因为mran 其实用的R 包也是来自cran 的镜像,所以也没啥问题:
R version 4.0.2 (2020-06-22) -- "Taking Off Again"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
R是自由软件,不带任何担保。
在某些条件下你可以将其自由散布。
用'license()'或'licence()'来看散布的详细条件。
R是个合作计划,有许多人为之做出了贡献.
用'contributors()'来看合作者的详细情况
用'citation()'会告诉你如何在出版物中正确地引用R或R程序包。
用'demo()'来看一些示范程序,用'help()'来阅读在线帮助文件,或
用'help.start()'通过HTML浏览器来看帮助文件。
用'q()'退出R.
Microsoft R Open 4.0.2
The enhanced R distribution from Microsoft
Microsoft packages Copyright (C) 2020 Microsoft Corporation
Using the Intel MKL for parallel mathematical computing (using 4 cores).
Default CRAN mirror snapshot taken on 2020-07-16.
See: https://mran.microsoft.com/.
只不过mran 毕竟是cran 的升级,因此版本更新慢了一点,R 都4.0.5 它还是0.2 版本。(其实影响也不大的)