Note, some parts of this codebase are designed to run on a HPC.
In particular, certain sections of R/fit_models.R and
R/process_models.R make use of either furrr::map or
parallel::mclapply.
The repo is structured as:
\
|- R
| |- main.R
| |- process_data.R
| |- fit_models.R
| |- process_models.R
| |- summary_plots.R
|- .gitignore
|- LICENCE
|- Makefile
|- README.md
|- analysis.slurm
To be able to actually run the code, the structure needs to be:
\
|- data
| |- primary
| | |- comp2021_Oct2025.RData
| | |- video_codes.csv
| | |- group_cover_transect.RData
| | |- comp21_broad_groups_lookup.csv
| |- processed
| |- modelled
|- R
| |- main.R
| |- process_data.R
| |- fit_models.R
| |- process_models.R
| |- summary_plots.R
|- outputs
|- .gitignore
|- LICENCE
|- Makefile
|- README.md
|- analysis.slurm
|- ltmp_dashboard1.sif
To run the full codebase on a HPC:
make slurm_R
The main output from this codebase is a heatmap that summarises the
contrasts of each coral group between early 1990s and early 2020s
conditional on sector and shelf of the Great Barrier Reef. This
heatmap is created in the /output/ directory.
After cloning the repo locally, you can step through the code. The intended order of R scripts is:
- main.R
- this is actually the main entry point and can be used to run the entire codebase
- important it loads the required R packages and defines/creates the paths
- process_data.R
- this script reads in the primary data sources and performs some data wrangling tasks
- processed data are stored in
/data/processed
- fit_models.R
- this script prepares the data for
INLAmodelling - this script fits the
INLAmodels in parellel usingfurrr - Note, it assumes there are at least 20 CPU cores available, if running outside a HPC environment, you are advised to reduced this
- individual models are stored in
/data/modelled
- this script prepares the data for
- process_models.R
- this script extracts posteriors from the
INLAmodels - collated data are stored in
/data/modelled/
- this script extracts posteriors from the
- summary_plots.R
- this script generates plots of estimated cover conditional on COMP2021, half-decade, sector and shelf
- this script performs various contrasts on the posteriors
- this script collates the contrasts and generates a summary heat map
- figures are output to
/output/
The scripts assume that the working directory is /R.