View source: R/class-register.R
register_model_type | R Documentation |
Define how to map a model type to model or summary object names when the
default mapping of {type}
to bbi_{type}_model
or bbi_{type}_summary
won't do. The primary use for this function is registering custom parent
types.
register_model_type(model_type, classes, class_type = c("model", "summary"))
model_type |
Model type, as recorded in the model YAML file. |
classes |
One or more classes to use for |
class_type |
The kind of object, "model" or "summary". |
create_model_object()
and create_summary_object()
are responsible for
creating model and summary objects for different model types (e.g.,
"bbi_nonmem_model" and "bbi_nonmem_summary" for "nonmem" model types). These
functions get the class name from model_type_to_classes()
, which by default
constructs the class from the model type (e.g., "nonmem" is mapped to
c("bbi_nonmem_model", ...)
).
That default value doesn't work if you want to define custom parents. For
example, bbr.bayes
package wants to map "nmbayes" model type to
c("bbi_nmbayes_model", "bbi_nonmem_model", ...)
so that bbi_nmbayes_model
objects can fall back to .bbi_nonmem_model
methods where appropriate. In
these cases, a package can call register_model_type()
within its
.onLoad()
to "register" the custom classes.
## Not run:
register_model_type("foo",
c("bbi_foo_model", "bbi_nonmem_model"),
"model")
register_model_type("foo",
c("bbi_foo_summary", "bbi_nonmem_summary"),
"summary")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.