Learn R Programming

Gadget3: Globally applicable Area Disaggregated General Ecosystem Toolbox v3

Gadget3 is a framework for producing marine ecosystem models. Gadget3 creates a R or TMB objective function for you, that can then be optimised with standard tools such as nlminb().

Gadget3 is primarily designed to produce models matching the behaviour of gadget2, although implementing new modelling systems would be possible

This package is part of suite of tools, including:

  • gadgetutils: Simplify common steps when setting up a gadget3 model
  • gadgetplots: Plot output from a gadget3 model
  • gadget2to3: Convert gadget2 model configuration to gadget3
  • mfdb: Marine ecosystem data management tool

Publications

Installation

gadget3 is available on CRAN:

> install.packages('gadget3')

You can also install the latest development version from github:

> remotes::install_github('gadget-framework/gadget3')

Documentation

The gadget3 documentation is published online. To get started, read the introductory vignette, which walks through the process of building a model.

For some real-life examples of gadget3 models, look in the gadget-models repository:

Development of gadget3

The documentation for the latest development version is published online.

You can install it with:

remotes::install_github("gadget-framework/gadget3")

Tests can be run with R CMD check. By default, tests are only run against the R backend for speed. To run against the TMB backend, set the G3_TEST_TMB environment variable, with one of:

  1. Sys.setenv(G3_TEST_TMB = 1) ; source('tests/test-action_grow.R')
  2. make, which runs both test & integration tests with G3_TEST_TMB
  3. make test G3_TEST_TMB="2", which runs all TMB tests

Releases are made with:

make release NEW_VERSION=0.9-0
git push --tags && git push

On success, upload the tarball to https://cran.r-project.org/submit.html

Acknowledgements

Gadget3 has received funding from:

  • Innviðasjóður Icelandic infrastructure grant #191774-0031
  • Under One Cod #206740-051
  • Fishing into the Future, Rannís grant of excellence #206967-051
  • NORSUSTAIN project funded by the joint Danish, Greenlandic, and Faroese Presidency of the Nordic Council of Ministers
  • Formas Swedish Research Council for Sustainable Development #2021-00826

Copy Link

Version

Install

install.packages('gadget3')

Monthly Downloads

430

Version

0.14-0

License

GPL-2

Issues

Pull Requests

Stars

Forks

Maintainer

Jamie Lentin

Last Published

October 15th, 2025

Functions in gadget3 (0.14-0)

aaa_lang

Gadget3 language utilities
aab_env

Gadget3 global environment
action_time

Gadget3 timekeeping actions
action_report

Gadget3 report actions
action_weightloss

Gadget3 weightloss action
action_spmodel

Gadget3 surplus production model
action_trace

Tracing and debugging tools
action_tagging

Gadget3 tag-release action
env_dif

g3 env: differentiable functions
eval

Evaluate G3 forumulas
action_spawn

Gadget3 spawning action
array_utils

Gadget3 array-handling utilities
likelihood_understocking

Gadget3 likelihood understocking action
init_val

Gadget3 parameter value setter
likelihood_bounds_penalty

Gadget3 likelihood bounds_penalty action
likelihood_sparsesample

Gadget3 likelihood actions for sparse data
language

G3 language extensions to R
formula_utils

Gadget3 formula helpers
likelihood_random

Gadget3 random effects likelihood actions
likelihood_catchdistribution

Gadget3 likelihood actions
likelihood_tagging_ckmr

Gadget3 CKMR likelihood
param_project

Gadget3 projected parameters
stock

Gadget3 stock storage
params

Gadget3 parameter helpers
run_tmb

Gadget3 actions into TMB code
step

G3 stock_* transformation functions
quota

Gadget3 projected quotas
stock_tag

Gadget3 tag dimension
stock_areas

Gadget3 stock area dimensions
stock_age

Gadget3 stock age dimensions
run_desc

Gadget3 actions into R code
stock_time

Gadget3 stock time dimensions
run_r

Gadget3 actions into R code
timedata

Gadget3 time-based data
timevariable

Gadget3 time-based formulas
suitability

Gadget3 suitability formulae
action_renewal

Gadget3 renewal actions
action_age

Gadget3 age action
action_naturalmortality

Gadget3 natural mortality action
action_migrate

Gadget3 migration action
action_order

Standard gadget3 order of actions
action_grow

Gadget3 growth action
action_mature

Gadget3 maturity action
action_predate

Gadget3 predation actions