Ubuntu下安装配置R+VSCode

1、依据 The Comprehensive R Archive Network 安装R

2、换源

nano ~/.Rprofile
options("repos" = c(CRAN="https://mirrors4.tuna.tsinghua.edu.cn/CRAN/"))

3、安装radian

sudo apt install pipx
pipx ensurepath
cd ~ && mkdir .pip && cd .pip
touch pip.conf && nano pip.conf
[global]
 
index-url=https://pypi.tuna.tsinghua.edu.cn/simple
 
timeout = 6000
 
[install]
 
trusted-host=pypi.tuna.tsinghua.edu.cn
 
disable-pip-version-check = true
pipx install radian

4、安装系统依赖

sudo apt install gcc g++ make cmake gfortran build-essential libcurl4-openssl-dev libssl-dev libxml2-dev libcairo2-dev libtiff-dev libxtst-dev libpng++-dev libbz2-dev

5、安装R依赖包

install.packages("languageserver")
install.packages("httpgd")

6、依据 Running Visual Studio Code on Linux 安装VSCode

7、配置VSCode

(1) 安装 R 和 R Debugger 插件

(2) Ctrl+K Ctrl+S 打开键盘快捷方式(JSON)

// begin of R language shortcuts
[{
    "key": "ctrl+shift+m",
    "command": "editor.action.insertSnippet",
    "when": "editorTextFocus && editorLangId == 'r'",
    "args": {
        "snippet": " %>% "
    }
},

{
    "key": "ctrl+enter",
    //"command": [ "python.execSelectionInTerminal", "cursorDown" ],
    "command": "macros.pythonExecSelectionAndCursorDown",
    "when": "editorTextFocus && editorLangId == 'python'"
}
]

(3) Ctrl+,

搜索 rpath.linux 填写 /usr/bin/R

搜索 rterm.linux 填写 /home/$USER/.local/bin/radian

注意:将$USER更改为用户名

搜索 httpgd 勾选

搜索 r.bracketed 勾选

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值