看到头疼的R的编辑环境,作为一个造福人类舒适编码的网管可不能坐视不管,下文仅从R的编辑环境(IDE)上贴出配置过程,供各位R患者使用. 本例示范机:Win10 | Vscode | Powershell

Install R

先从国内镜像地址下载并安装R,这里直接给出地址 mirrors.tuna.tsinghua.edu.cn/CRAN/ 附: Download R 4.0.3 for Windows

  1. 下载后双击.exe文件唤出安装界面
  2. 选择默认选项下一步(N)直至完成即可

Install radian

号称21世纪的交互终端,python专为R打造的终端工具,难兄难弟之间的福音.

  1. pip install radian 通过pip安装
  2. Set-Alias -Name r -Value radian 设置radian终端的别名
  3. vim ~/.Rprofile 在User目录(cd ~)下配置自定义参数 ``` options(radian.auto_indentation = FALSE) options(radian.color_scheme = “monokai”) #更改色系风格,未作尝试,应该和vim色系风格一致

auto match brackets and quotes

options(radian.auto_match = TRUE)

auto indentation for new line and curly braces

options(radian.auto_indentation = TRUE) options(radian.tab_size = 4)

timeout in seconds to cancel completion if it takes too long

set it to 0 to disable it

options(radian.completion_timeout = 0.05)

insert new line between prompts

options(radian.insert_new_line = FALSE)

配置按键映射 <- 这两个键单独按起来太不友好了,{}内可添加自定义映射风格

options(radian.escape_key_map = list( list(key = “-“, value = “ <- “), list(key = “m”, value = “ %>% “) )) ```

参考

R环境配置