Skip to contents

This is used to use the results from one simulation as the starting values for another simulation.


setInitialValues(params, sim, time_range)



A MizerParams() object


A MizerSim object.


The time range (either a vector of values, a vector of min and max time, or a single value) to average the abundances over. Default is the final time step.


The params object with updated initial values and initial effort. Because of the way the R language works, setInitialValues() does not make the changes to the params object that you pass to it but instead returns a new params object. So to affect the change you call the function in the form params <- setInitialValues(params, sim).


The initial abundances (for both species and resource) in the params object are set to the abundances in a MizerSim object, averaged over a range of times. Similarly, the initial effort in the params object is set to the effort in the MizerSim object, again averaged over that range of times. When no time range is specified, the initial values are taken from the final time step of the simulation.


if (FALSE) {
params <- NS_params
sim <- project(params, t_max = 20, effort = 0.5)
params <- setInitialValues(params, sim)