|
1 | 1 | #! /usr/local/bin/Rscript |
2 | 2 | # install R dependencies |
3 | 3 |
|
4 | | -# to match rocker/verse:4.4 used in py-rocker-base |
5 | | -# look up the CRAN env set in the Dockerfile used |
| 4 | +# CRAN binaries repo (from image build) |
6 | 5 | repo <- "https://p3m.dev/cran/__linux__/noble/2025-10-30" |
7 | 6 |
|
8 | | -# Check if the first library path is inside /home |
| 7 | +# Guardrail: don’t install into /home in the Docker build context |
9 | 8 | install_lib <- .libPaths()[1] |
10 | 9 | if (grepl("^/home", install_lib)) { |
11 | | - stop("Error: Packages are being installed to /home, which will be removed in the final image. Exiting.", call. = FALSE) |
| 10 | + stop( |
| 11 | + "Error: Packages are being installed to /home, which will be removed in the final image. Exiting.", |
| 12 | + call. = FALSE |
| 13 | + ) |
12 | 14 | } |
13 | 15 |
|
14 | | -install.packages(c("rstac", "quarto", "aws.s3", "reticulate", "gdalcubes", "rnaturalearth", "earthdatalogin"), repos=repo) |
15 | | -install.packages("rnaturalearthdata", repos=repo) |
| 16 | +# Main R ecosystem installed via rocker scripts: https://github.com/rocker-org/rocker-versioned2/scripts |
| 17 | +# Tidyverse packages are installed via install_tidyverse.sh |
| 18 | +# Geospatial packages are installed via install_geospatial.sh |
16 | 19 |
|
17 | | -# CoastWatch required |
18 | | -list.of.packages <- c("parsedate", "reshape2", "gridGraphics", "PBSmapping", |
19 | | - "date", "openair", "cmocean", "plotdap", "rerddapXtracto") |
20 | | -install.packages(list.of.packages, repos=repo) |
| 20 | +# Extra packages added or ensured to be present |
21 | 21 |
|
22 | | -# ------- OceanHackWeek R image customizations ------- |
| 22 | +# ------------------------------------------------------------ |
| 23 | +# 1) Core plumbing + data access + interoperability |
| 24 | +# ------------------------------------------------------------ |
| 25 | +list.of.packages <- c( |
| 26 | + "quarto", |
| 27 | + "reticulate", |
| 28 | + "aws.s3", |
| 29 | + "earthdatalogin", |
| 30 | + "rstac", |
| 31 | + "geonames", |
| 32 | + "isdparser", |
| 33 | + "readHAC", |
| 34 | + "parsedate" |
| 35 | +) |
| 36 | +install.packages(list.of.packages, repos = repo) |
| 37 | + |
| 38 | +# ------------------------------------------------------------ |
| 39 | +# 2) Geospatial + mapping + earth/ocean data utilities |
| 40 | +# ------------------------------------------------------------ |
| 41 | +list.of.packages <- c( |
| 42 | + "gdalcubes", |
| 43 | + "rnaturalearth", |
| 44 | + "rnaturalearthdata", |
| 45 | + "PBSmapping", |
| 46 | + "ggspatial", |
| 47 | + "rosm", |
| 48 | + "sfnetworks", |
| 49 | + "marmap", |
| 50 | + "robis", |
| 51 | + "oce", |
| 52 | + "ocedata", |
| 53 | + "plotdap", |
| 54 | + "rerddapXtracto", |
| 55 | + "openair", |
| 56 | + "cmocean" |
| 57 | +) |
| 58 | +install.packages(list.of.packages, repos = repo) |
| 59 | + |
| 60 | +# ------------------------------------------------------------ |
| 61 | +# 3) Data wrangling + visualization + reporting |
| 62 | +# ------------------------------------------------------------ |
| 63 | +list.of.packages <- c( |
| 64 | + "reshape2", |
| 65 | + "gridGraphics", |
| 66 | + "matrixStats", |
| 67 | + "plot.matrix", |
| 68 | + "corrplot", |
| 69 | + "cowplot", |
| 70 | + "hexbin", |
| 71 | + "kableExtra", |
| 72 | + "latticeExtra", |
| 73 | + "mapplots", |
| 74 | + "metR", |
| 75 | + "plotly", |
| 76 | + "rasterVis", |
| 77 | + "vioplot" |
| 78 | +) |
| 79 | +install.packages(list.of.packages, repos = repo) |
23 | 80 |
|
24 | | -# TODO: Group into high-level (eg, sfnetworks, oce, robis) vs low-level and narrow (eg, akima, mda) |
25 | | -list.of.packages_ohw <- c( |
26 | | - "plot.matrix", "isdparser", "geonames", "readHAC", |
27 | | - "greybox", "sfnetworks", "smooth", "oce", "ocedata", |
28 | | - "akima", "ape", "biomod2", "caret", "caTools", "CircStats", "corrplot", "cowplot", |
29 | | - "dismo", "doParallel", "earth", "fields", "forecast", "ggspatial", "glmnet", "hexbin", |
30 | | - "kableExtra", "latticeExtra", "lmtest", "mapplots", "marmap", "matrixStats", "mda", "metR", |
31 | | - "palmerpenguins", "plotly", "rasterVis", "robis", "rosm", "tseries", "tsibble", "udunits2", "urca", "vioplot" |
| 81 | +# ------------------------------------------------------------ |
| 82 | +# 4) Modeling + time series + statistical tooling |
| 83 | +# ------------------------------------------------------------ |
| 84 | +list.of.packages <- c( |
| 85 | + "caret", |
| 86 | + "biomod2", |
| 87 | + "glmnet", |
| 88 | + "doParallel", |
| 89 | + "earth", |
| 90 | + "fields", |
| 91 | + "dismo", |
| 92 | + "caTools", |
| 93 | + "mda", |
| 94 | + "ape", |
| 95 | + "CircStats", |
| 96 | + "palmerpenguins", |
| 97 | + "forecast", |
| 98 | + "lmtest", |
| 99 | + "tseries", |
| 100 | + "tsibble", |
| 101 | + "urca", |
| 102 | + "akima", |
| 103 | + "smooth", |
| 104 | + "greybox", |
| 105 | + "udunits2" |
32 | 106 | ) |
33 | | -install.packages(list.of.packages_ohw, repos=repo) |
| 107 | +install.packages(list.of.packages, repos = repo) |
34 | 108 |
|
35 | 109 | # TODO: Should they include upgrade=FALSE? eeh: yes to prevent the dependencies from upgrading. |
36 | 110 | remotes::install_github("hvillalo/echogram", upgrade=FALSE) |
|
0 commit comments