timevariable {gadget3} | R Documentation |
Gadget3 time-based formulas
Description
Switch formula based on current time step
Usage
g3_timevariable(lookup_name, fs)
Arguments
lookup_name |
A unique name for this lookup, e.g. |
fs |
A list of formula objects, named with either "init", "(year)" or "(year)-(step)". When the matching time step is reached, the value of the lookup will be changed. |
Details
This is mostly for backwards compatibility with gadget2, before using this,
consider other simpler options, e.g. g3_timeareadata
or the
by_year option in g3_parameterized
.
Value
A formula object that will switch values at the given time points.
Examples
ling_imm <- g3_stock('ling_imm', seq(20, 156, 4)) %>% g3s_age(3, 10)
naturalmortality_action <- g3a_naturalmortality(ling_imm,
g3a_naturalmortality_exp( g3_timevariable("lingimm.M", list(
# Start off using lingimm.M.early
"init" = g3_parameterized("lingimm.M.early"),
# At 2005 step 2, switch to lingimm.M.mid
"2005-02" = g3_parameterized("lingimm.M.mid"),
# At 2010 step 1, switch to lingimm.M.late
"2010" = g3_parameterized("lingimm.M.late")))))
[Package gadget3 version 0.12-1 Index]