Description Usage Arguments Value Note Examples
Pick models from model
and world
while giving a higher priority to any model
object that has the same name between the two. For example, if both have a model
object called model_one
, although they have totally different values, this will
pick the model_one
from model
and not the other model_one
in world
. The
function goes over both objects to find all models with the names in required_models
.
1 | pick_models(model, world, required_models, as_r6model = FALSE)
|
model |
|
world |
a World object. |
required_models |
|
as_r6model |
default as FALSE, if TRUE all |
a list of models.
This is used by event functions to prioritise which models, from the user argument or the one added to World, to use. An error will be raised if not all required models are found.
1 2 3 4 5 6 7 8 9 10 11 12 | # pick_model looks for 'model_one'
create_toy_world()
my_model <- list(model_two = list(yes = 0.1, no = 0.9))
world$add(x = list(yes = 0.5, no = 0.5), "model_one")
world$add(x = list(yes = 0.5, no = 0.5), "model_two")
REQUIRED_MODELS <- c("model_one", "model_two")
final_model <- pick_models(my_model, world, REQUIRED_MODELS)
# you can see that the final pick picked model_one from `my_model` and
# not the one that was added to world as it gives hihger priority to the object
# in `model`.
final_model
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.