View source: R/get_params_per_sit.R
get_params_per_sit | R Documentation |
Return a list of parameters active for a given situation
get_params_per_sit(sit_groups, situation, param_vec)
sit_groups |
Defines the groups of situations for each parameter
A named list containing for each parameter the list of situations per group
( |
situation |
The name of the situation |
param_vec |
The (named)vector of parameters from which to extract values |
Names of parameters in param_vec
and sit_groups
should
be the same. If param_vec
is not named, the parameters in param_vec
will be considered in the same order as in sit_group
A subvector of param_vec
containing only the values that are
active for the given situation
sg <- list(
p1 = list(sit_list = list(
c("sit1", "sit2", "sit3"),
c("sit4", "sit5", "sit6")
)),
p2 = list(sit_list = list(c(
"sit1", "sit2", "sit3", "sit4", "sit5",
"sit6"
))),
p3 = list(sit_list = list(c("sit1", "sit2", "sit3"), c(
"sit4", "sit5",
"sit6"
)))
)
vec <- c(1, 2, 3, 4, 5)
names(vec) <- CroptimizR:::get_params_names(sg)
CroptimizR:::get_params_per_sit(sg, "sit2", vec)
# should give c(p1=1,p2=3,p3=4)
CroptimizR:::get_params_per_sit(sg, "sit4", vec)
# should give c(p1=2,p2=3,p3=5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.