pset = ps(
i = p_int(),
z = p_lgl()
)
ps_replicate(pset, 3)
ps_replicate(pset, prefixes = c("first", "last"))
pset$values = list(i = 1, z = FALSE)
psr = ps_replicate(pset, 2, tag_sets = TRUE, tag_params = TRUE)
# observe the effect of tag_sets, tag_params:
psr$tags
# note that values are repeated as well
psr$values
psr$set_values(rep1.i = 10, rep2.z = TRUE)
psr$values
# use `any_tags` to get subset of values.
# `any_tags = ` is preferable to `tags = `, since parameters
# could also have other tags. `tags = ` would require the
# selected params to have the given tags exclusively.
# get all values associated with the original parameter `i`
psr$get_values(any_tags = "param_i")
# get all values associated with the first repetition "rep1"
psr$get_values(any_tags = "set_rep1")
Run the code above in your browser using DataLab