RStudio Serverο
Two variants are available depending on how R is installed:
Variant |
R Installation |
Best For |
|---|---|---|
|
Posit R image overlays |
Normal |
|
Conda ( |
All packages via conda-forge/bioconda, reproducible env export |
condatainer helper -u
condatainer helper rstudio-server -w # Posit R
condatainer helper rstudio-server-conda -w # Conda R
See Helper Scripts for SSH port forwarding setup, resource flags, configuration, and reuse mode.
rstudio-server (Posit R)ο
Uses Posit R image overlays β a separate r<version> overlay is auto-installed alongside rstudio-server and build-essential.
Writable Overlayο
# Create a 30G writable overlay in the current directory
condatainer o -s 30g
# With Python (needed for reticulate):
condatainer o -s 30g -- python=3.11 conda
Flagsο
condatainer helper rstudio-server --help
Flag |
Description |
Default |
|---|---|---|
|
R version (e.g. |
latest available |
|
RStudio password (empty = no auth) |
(empty) |
Partial versions are accepted: -r 4.4 uses the latest 4.4.x available. See Helper Scripts for resource and overlay flags.
Installing R Packagesο
The build-essential overlay provides common system libraries. Install packages normally:
install.packages("tidyverse")
BiocManager::install("DESeq2")
pak::pak("user/repo")
Rprofile Setupο
When no *.Rproj file exists in the working directory, CondaTainer creates:
A
*.Rprojfile with default settingsA
.Rprofileconfigured for Posit Public Package Manager (P3M) binary packages
If *.Rproj already exists, .Rprofile is not modified. To use only CRAN:
.set_repository_options(repo = "cran", latest_cran = TRUE)
Missing System Librariesο
Create a custom overlay for extra system libraries β see Custom OS Overlays:
condatainer helper rstudio-server -o additional-deps.sqf
Run R Without RStudioο
condatainer exec -o r4.4.3 -o build-essential -o env.img Rscript script.R
condatainer exec -o r4.4.3 -o build-essential -o r-deps.sqf -o env.img Rscript script.R
rstudio-server-conda (Conda R)ο
R is installed in the writable overlay via mm-install r-base. No separate R overlay is needed.
Note
Always use mm-install (Conda) to install R packages in this variant. Do not use install.packages() β it may conflict with the Conda-managed environment.
Writable Overlay with Rο
# Create a 30G overlay with R pre-installed
condatainer o -s 30g -- r-base=4.4 r-tidyverse
# Enter the overlay to install more packages
condatainer e
Inside the overlay:
mm-pin r-base # pin R version to prevent accidental updates
mm-install r-seurat r-patchwork bioconductor-clusterprofiler
mm-install python=3.11 conda # add Python for reticulate
Package Managementο
Conda naming conventions:
CRAN:
r-<name>(e.g.r-ggplot2,r-dplyr)Bioconductor:
bioconductor-<name>(e.g.bioconductor-deseq2)
mm-search r-presto
mm-install r-ggplot2 bioconductor-deseq2
mm-export --no-builds > conda-env.yml # export full environment
Run R Without RStudioο
condatainer exec -o env.img Rscript script.R
Once running, open the project in R:
rstudioapi::openProject("/scratch/user/my-project")
Common Issuesο
UID conflict (UID = 1000)ο
The Posit R container image reserves UID 1000 for its internal user. If your account UID is 1000, rstudio-server will not start β use rstudio-server-conda instead.