View source: R/copy-model-helpers.R
update_model_id | R Documentation |
Helper to update the model ID (aka the "run number" if models are named
numerically) in the new control stream of a model created with
copy_model_from()
. See Details section.
update_model_id(
.mod,
.suffixes = c(".msf", ".ext", ".tab", ".chn", "par.tab"),
.additional_suffixes = NULL
)
.mod |
The |
.suffixes |
Character vector of suffixes to be matched for replacement.
Matching is case insensitive (see Details). Note that if passed suffixes
are file extensions, you must include the leading period (e.g. pass
|
.additional_suffixes |
Character vector of suffices to match in
addition to those passed in |
This function updates all occurrences of the model ID from
the parent model and replaces them with model ID from the
new model. Importantly, it relies on the assumption that .mod
will have the parent model ID as
the first entry in .mod$based_on
. This will be true if .mod
was created by
copy_model_from()
.
It will look for that parent model ID before all strings
passed to .suffixes
or .additional_suffixes
(e.g. {parent_mod}.MSF
, etc.)
replace it with get_model_id(.mod)
wherever found.
.suffixes
defaults to the following:
.msf
.ext
.chn
.tab
par.tab
All matches are not case sensitive but replacements are. For example, if
.msf
is passed as a suffix, {parent_mod}.MSF
and {parent_mod}.msf
would
both be replaced, but the case of the suffix in the control stream will be
maintained as is.
Invisibly returns .mod
, to enable piping (i.e. from
copy_model_from()
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.