renv with packages for vscode on Ubuntu LTS. See https://code.visualstudio.com/docs/languages/r for more info.
Adapted from https://github.com/REditorSupport/vscode-R/wiki/Getting-Started and https://github.com/REditorSupport/vscode-R/wiki/Working-with-renv-enabled-projects
- Install R. See: https://cran.r-project.org/bin/linux/ubuntu
- Install renv. Inside R:
install.packages("renv") - In this folder:
renv::restore() - Put output of
renv::paths$library()intor.libPaths, e.g.:
"r.libPaths": [
"/home/user/R/vscode-R/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu"
]
See:
- https://github.com/REditorSupport/vscode-R/wiki/Installation:-Linux
- https://github.com/REditorSupport/vscode-R/wiki/Recommended-extensions-and-configuration
sudo apt install pandoc
Use pipx or pip install --user radian to install for user, then add path to vscode settings, e.g.:
"r.rterm.linux": "${userHome}/.local/bin/radian",
Make sure to exclude site-specific settings from sync:
"settingsSync.ignoredSettings": [
"r.libPaths",
"r.rterm.linux",
]
linters: linters_with_defaults(
commented_code_linter = NULL,
line_length_linter(100),
object_usage_linter = NULL,
indentation_linter = indentation_linter(indent = 4L)
)
encoding: "UTF-8"
r <- getOption("repos")
r["CRAN"] <- "https://cloud.r-project.org"
options(repos = r)
options(Ncpus = parallel::detectCores())
rm(r)
renv::install replaces BiocManager, devtools::install_github and remotes::install_github. E.g.:
renv::install("bioc::Biobase")renv::install("jaredhuling/jcolors")
To enable BiocManager and not automatically install packages when initializing renv, use:
renv::init(bare = TRUE, bioconductor = TRUE)
Don't forget to renv::activate() and renv::snapshot().