Skip to content

R语言学习

安装

官网下载安装包 [Download R-4.3.3 for Windows. The R-project for statistical computing.](Download R-4.3.3 for Windows. The R-project for statistical computing.)

环境配置

使用Vscode

  1. 插件安装:R,R Debugger

  2. 在R语言终端中输入:install.packages("languageserver")

  3. 在R语言终端中输入:install.packages("httpgd")

  4. 安装radian(可以理解为R语言当中的iPython):pip install -U radian

  5. 配置快捷键,便于调试R程序

    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'"
    }
    ]

完成,现在可以直接在vscode中新建R语言文件(.r),然后点击ctrl+Enter会运行该行代码并自动跳转到下一行