setCompartments applies given values to compartments of the model depending on the key argument.

setCompartments(
  key = NULL,
  name = NULL,
  type = NULL,
  dimensionality = NULL,
  initial_size = NULL,
  initial_expression = NULL,
  expression = NULL,
  data = NULL,
  preserve_concentrations = FALSE,
  model = getCurrentModel()
)

Arguments

key

Identify which compartment to edit by specifying it's key, as string. Also supports fragments of keys, if uniquely matching one compartment.

name

Name to set, as string.

type

Type ("fixed", "assignment", "ode") to set, as string.

dimensionality

Dimensionality to set (0D, 1D, 2D, 3D), as number.

initial_size

Initial size to set, as string.

initial_expression

Initial expression to set, as string, finite numeric, or logical.

expression

Expression to set, as string, finite numeric, or logical.

data

A data frame as given by getCompartments which will be applied before the other arguments.

preserve_concentrations

Whether changes in compartment size should keep species concentrations fixed, as flag. If set to TRUE, size changes will in turn affect species particle numbers. Has no effect on expressions.

model

A model object.

Details

Use the key argument to specify which compartment to modify and any of the other arguments to specify the value to set. The function is fully vectorized. If a NA value is supplied, the model value is kept unchanged.

The online article on managing model entities provides some further context.