timevariable.Rd
Switch formula based on current time step
g3_timevariable(lookup_name, fs)
A unique name for this lookup, e.g. "igfs_landings"
.
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.
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
.
A formula object that will switch values at the given time points.
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")))))