A function that replaces a Stock, Fleet, Obs, or Imp object from an OM with one from another object.
Replace( OM, from, Sub = c("Stock", "Fleet", "Obs", "Imp"), Name = NULL, silent = FALSE )
An operating model object (class OM) which will be updated with a sub-model from another OM
An object of class
Imp to be replace the values in
A character string specifying what object type to replace (only used if
from is class
"Stock", "Fleet", "Obs", or "Imp" (default is all four which is probably not what you want to do)
Character. Name for the new OM object (
Should messages be printed?
An object of class OM
# Replace Stock OM <- MSEtool::testOM OM2 <- Replace(OM, Blue_shark) #> ✔ Replacing sub-model: Stock # Replace Fleet OM <- MSEtool::testOM OM2 <- Replace(OM, Generic_DecE) #> ✔ Replacing sub-model: Fleet # Replace Fleet from another OM OM1 <- new("OM", Albacore, Generic_DecE, Perfect_Info, Overages) OM2 <- new("OM", Blue_shark, Generic_IncE, Generic_Obs, Perfect_Imp) OM1a <- Replace(OM1, OM2, "Fleet") #> ✔ Replacing sub-models: Fleet