| ps_union {paradox} | R Documentation |
Create a ParamSet from a list of ParamSets
Description
This emulates ParamSetCollection$new(sets), except that the result is a flat ParamSet, not a ParamSetCollection.
The resulting object is decoupled from the input ParamSet objects: Unlike ParamSetCollection, changing $values of
the resulting object will not change the input ParamSet $values by reference.
This emulates ParamSetCollection$new(sets), which in particular means that the resulting ParamSet has all the Domains
from the input sets, but some $ids are changed: If the ParamSet is given in sets with a name, then the Domains will
have their <id> changed to <name in "sets">.<id>. This is also reflected in deps.
The c() operator, applied to ParamSets, is a synony for ps_union().
Usage
ps_union(sets, tag_sets = FALSE, tag_params = FALSE)
Arguments
sets |
( |
tag_sets |
( |
tag_params |
( |
Examples
ps1 = ps(x = p_dbl())
ps1$values = list(x = 1)
ps2 = ps(y = p_lgl())
pu = ps_union(list(ps1, ps2))
# same as:
pu = c(ps1, ps2)
pu
pu$values
pu$values$x = 2
pu$values
# p1 is unchanged:
ps1$values
# Prefixes automatically created for named elements.
# This allows repeating components.
pu2 = c(one = ps1, two = ps1, ps2)
pu2
pu2$values