1
0
Files
R-within-CondaEnv/README.md
2025-08-20 17:11:49 +08:00

57 lines
1.5 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Conda虚拟环境中的R语言项目模板
用于创建项目独有的R隔离环境实现R语言的细粒度控制。
## 安装前提
- Linux / MacOS / WSL 系统
- VSCode 代码编辑器
插件扩展安装:
- R
- R Debugger
- Miniforge / Miniconda / Anaconda 虚拟环境管理(即可执行`conda`命令)
> [!NOTE]
> 自行检查conda的镜像源配置以加速库的下载安装。
- Git 代码同步工具
## 操作步骤
0. 克隆本项目到指定的位置或者下载代码zip包
`git clone https://git.unvec.site/stevenhobs/R-with-Conda <项目路径>`
`cd <项目路径> && rm -r .git/` # 删除.git记录
1. 初始化conda虚拟环境
`conda create -y -p .conda -c conda-forge r-base r-languageserver r-devtools r-httpgd r-rlang r-jsonlite radian`
2. 初始化R语言调试器两种方式任选其一
- VSCode命令面板搜索执行 `R Debugger: Update or install the required R Package`进行安装R的VSC调试库
- 在R的控制台中执行指令 `devtools::install_github("ManuelHentschel/vscDebugger")`
> [!NOTE]
> 此操作需要访问Github平台以获取源码编译安装请确保 github.com 可正常访问
3. 库的安装
确保在当前项目的`.conda`虚拟环境中,以下几种:
- conda 命令
查找包 `conda search -p .conda -c conda-forge r-包名`
安装包 `conda install -p .conda -c conda-forge r-包名`
- 采用R控制台命令安装`install.packages()`
- VSCode R扩展提供的包管理视图