From 1cec12dbb9d8a799bd46dd860fa9fda1e4e30182 Mon Sep 17 00:00:00 2001 From: Even Bell <130771607+2000e@users.noreply.github.com> Date: Fri, 21 Mar 2025 12:02:27 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .Rprofile | 2 ++ .lintr | 5 +++++ .vscode/settings.json | 21 +++++++++++++++++---- README.md | 18 ++++++------------ 4 files changed, 30 insertions(+), 16 deletions(-) create mode 100644 .Rprofile create mode 100644 .lintr diff --git a/.Rprofile b/.Rprofile new file mode 100644 index 0000000..bafa7a6 --- /dev/null +++ b/.Rprofile @@ -0,0 +1,2 @@ +# R 配置 +options("repos" = c(CRAN = "https://mirrors.cernet.edu.cn/CRAN/")) diff --git a/.lintr b/.lintr new file mode 100644 index 0000000..7cdbe84 --- /dev/null +++ b/.lintr @@ -0,0 +1,5 @@ +linters: linters_with_defaults( + line_length_linter(120), + object_usage_linter = NULL, + commented_code_linter = NULL + ) \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index c5c15fe..2cfedc0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,14 +1,27 @@ /* VSCode 项目配置 */ { "r.rpath.linux": ".conda/bin/R", + "r.libPaths": [ + ".conda/bin/R/library" + ], "r.rterm.linux": "${workspaceFolder}/.conda/bin/R", "r.rterm.option": [ "--no-save", "--no-restore" ], "r.plot.useHttpgd": true, - "r.libPaths": [ - ".conda/bin/R/library" - ], - "files.eol": "\n" + "r.lsp.diagnostics": true, + "r.alwaysUseActiveTerminal": true, + "r.bracketedPaste": true, + "r.sessionWatcher": true, + "[r]": { + "editor.defaultFormatter": "REditorSupport.r", + "editor.formatOnSave": true + }, + "[rmd]": { + "editor.defaultFormatter": "REditorSupport.r", + "editor.formatOnSave": true + }, + "files.eol": "\n", + "terminal.integrated.defaultProfile.linux": "R Terminal", } \ No newline at end of file diff --git a/README.md b/README.md index 887fee0..4f6e244 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ - VSCode 代码编辑器 VSCode中插件扩展安装: - - Python + - R - R Debugger @@ -24,13 +24,7 @@ 1. 初始化conda虚拟环境 - 创建虚拟环境,可以使用VSCode的Python解释器选择功能创建conda虚拟环境,创建完虚拟环境后选择对应的虚拟环境,使用conda安装对应的R依赖包 - - `conda install -c conda-forge r-base r-languageserver r-httpgd r-devtools radian` - - 或者使用命令创建虚拟环境并同时下载依赖包 - - `conda create -p .condarc -c conda-forge r-base r-languageserver r-devtools r-httpgd radian` + `conda create -p .conda -c conda-forge r-base r-languageserver r-devtools r-httpgd radian` 2. 初始化R Debugger @@ -40,15 +34,15 @@ `devtools::install_github("ManuelHentschel/vscDebugger")` -> [!NOTE] -> 此操作需要访问Github平台以获取源码编译安装,请确保 github.com 可正常访问 + > [!NOTE] + > 此操作需要访问Github平台以获取源码编译安装,请确保 github.com 可正常访问 3. 库的安装 在当前的conda环境下, - 使用`conda search conda-forge::r-包名` 搜索对应的包 + 使用`conda search -p .conda -c conda-forge r-包名` 搜索对应的包 - 使用`conda install conda-forge::r-包名` 安装对应的包 + 使用`conda install -p .conda -c conda-forge r-包名` 安装对应的包 或者采用R通用的安装(CRAN)