If the function you need to overwrite is one of the mizer rate functions,
then you should use setRateFunction()
instead of this function. Similarly
you should use resource_dynamics()<-
to change the resource dynamics and
setReproduction()
to change the density-dependence in reproduction.
You should also investigate whether you can achieve your goal by introducing
additional ecosystem components with setComponent()
.
If you find that your goal really does require you to overwrite a mizer
function, please also create an issue on the mizer issue tracker at
https://github.com/sizespectrum/mizer/issues to
describe your goal, because it will be interesting to the mizer community
and may motivate future improvements to the mizer functionality.
Note that customFunction()
only overwrites the function used by the mizer
code. It does not overwrite the function that is exported by mizer. This
will become clear when you run the code in the Examples section.
This function does not in any way check that your replacement function is
compatible with mizer. Calling this function can totally break mizer.
However you can always undo the effect by reloading mizer with
detach(package:mizer, unload = TRUE)
library(mizer)