将VScdoe的R终端替换为radian

Miniconda介绍

Miniconda is a free minimal installer for conda. It is a small, bootstrap version of Anaconda that includes only conda, Python, the packages they depend on, and a small number of other useful packages, including pip, zlib and a few others.

Miniconda 主页
Miniconda 历史版本

radian介绍

radian is an alternative console for the R program with multiline editing and rich syntax highlight. One would consider radian as a ipython clone for R, though its design is more aligned to julia.

radian主页

以下操作均是在Windows 10 LTSC 2019环境

安装radian

  1. 安装Minicoda 3(python 3.8支持tensorflow)。
  2. 根据清华镜像(https://mirror.tuna.tsinghua.edu.cn/help/anaconda/)提示操作。
  3. 运行 conda powershell propmt(以下均在此环境)
  4. 用coda命令管理库
    • 查看已经安装的库:coda list
    • 安装库:coda install 库名
  5. 安装常用的库
    • scipy conda install scipy
  6. 安装radian
    pip install -U radian
    或安装开发版
    pip install -U git+https://github.com/randy3k/radian
    运行radian radian

在VScode中用radian替换rterm

ctrl+,打开设置,左侧“扩展->R”然后设置如下:(R安装在D:\ProgramFiles\ACsoft\R)

  1. "Rpath: Windows"设为D:\ProgramFiles\ACsoft\R\bin\x64\R.exe
  2. "Rterm: Windows"中将默认的rterm(D:\ProgramFiles\ACsoft\R\bin\x64\R.exe)替换为radian.exe的路径D:\ProgramFiles\Coding\Miniconda3\Scripts\radian.exe。(Minicoda安装在D:\ProgramFiles\Coding\Miniconda3)
  3. "Rterm: Option"去掉--no-save--no-store
  4. 重新启动VScode
  5. 发送R代码到控制台,Radian出现。
    • 第一次发送调用R终端,第2次才会将代码发送到终端。
    • 发送快捷键ctrl+enter
  6. 右侧的窗口显示作图、帮助等信息(类似Rstudio的界面)

上面设置在setting.json中如下:

    "r.rterm.windows": "D:\\ProgramFiles\\Coding\\Miniconda3\\Scripts\\radian.exe",
    "r.rpath.windows": "D:\\ProgramFiles\\ACsoft\\R\\bin\\x64\\R.exe",
    "r.lsp.debug": true,
    "r.bracketedPaste": true,   //使用radian设置
    "r.sessionWatcher": true,   //使用radian设置
    "r.rterm.option": [],       //使用radian设置
posted @ 2021-04-12 21:03  hzworld  阅读(2491)  评论(1编辑  收藏  举报