Skip to content

Instantly share code, notes, and snippets.

@samcofer
Last active February 25, 2025 02:13
Show Gist options
  • Save samcofer/20227ab47991f5298c5d3cf92aee87c1 to your computer and use it in GitHub Desktop.
Save samcofer/20227ab47991f5298c5d3cf92aee87c1 to your computer and use it in GitHub Desktop.
Pak based package installation for R
# Start from the RStudio Workbench base image
FROM rstudio/rstudio-workbench:jammy
# Set repository options globally for all R sessions
RUN echo 'options(repos = c( CRAN = "https://packagemanager.posit.co/cran/__linux__/jammy/latest", CRAN_20240401 = "https://packagemanager.posit.co/cran/__linux__/jammy/2024-04-01", BioCsoft = "https://bioconductor.org/packages/3.13/bioc", BioCann = "https://bioconductor.org/packages/3.13/data/annotation", BioCexp = "https://bioconductor.org/packages/3.13/data/experiment", BioCworkflows = "https://bioconductor.org/packages/3.13/workflows" ))' > /opt/R/4.4.1/lib/R/etc/Rprofile.site
# Install pak for efficient dependency resolution
RUN /opt/R/4.4.1/bin/Rscript -e 'install.packages("pak", repos = "https://packagemanager.posit.co/cran/__linux__/jammy/latest")'
# Install required R packages using pak
RUN /opt/R/4.4.1/bin/Rscript -e 'pak::pkg_install(c( \
"shiny", "tidyverse", "dplyr", "shinybusy", \
"shinyWidgets", "shinyjs", "gt", "lubridate", "RColorBrewer", "ggpubr", "ggrepel", \
"DT", "survival", "gridExtra", "plotly", "ggplot2", "ggsurvfit", "survminer", \
"renv", "ssh", "jsTreeR", "R.cache", "styler", \
"languageserver", "RPostgres"), dependencies = TRUE)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment