Windows安装R

起因

因为BenchmarkDotNet生成图表,需要安装R才可以.顺便记录一下R.
R下载Windows版本

修改R仓库地址

在R/R-4.1.1/etc目录下,找到Rprofile.site文件.
这里使用的是清华的源仓库: http://mirrors.tuna.tsinghua.edu.cn/CRAN/
# 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
#将下边这几行注释移除, r["CRAN"]地址改为 "http://mirrors.tuna.tsinghua.edu.cn/CRAN/
local({r <- getOption("repos")
       r["CRAN"] <- "http://mirrors.tuna.tsinghua.edu.cn/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()

将R的安装目录加入系统环境中的,只是为了使用方便,可以全局使用

#执行R脚本
Rscript.exe .\BuildPlots.R

执行R脚本

执行R脚本,生成图表文件

秋风 2021-08-17