The prm
class is required for ParameterSet objects, it
allows specifying a parameter as a named set and optionally setting values
and tags.
prm(id, support, value = NULL, tags = NULL, .check = TRUE)
(character(1)
)
Parameter identifier.
([set6::Set]|character(1))
Either a set object from
set6 or a character representing the set if it is already present
in the support_dictionary. If a set6::Set is provided then the set and
its string representation are added automatically to support_dictionary
in order to provide fast internal checks. Common sets (such as the reals,
naturals, etc.) are already provided in support_dictionary.
ANY
Optional to assign the parameter, will internally
be checked that it lies within the given support.
(character()
)
An optional character vector of tags to apply to the parameter. On their own
tags offer little extra benefit, however they can be assigned properties
when creating ParameterSet objects that enable them to be more powerful.
For internal use only.
library(set6)
# Constructing a prm with a Set support
prm(
id = "a",
support = Reals$new(),
value = 1
)
#> $id
#> [1] "a"
#>
#> $support
#> [1] "ℝ"
#>
#> $value
#> [1] 1
#>
#> $tags
#> NULL
#>
#> attr(,"class")
#> [1] "prm"
# Constructing a prm with a support already in the dictionary
prm(
id = "a",
support = "reals",
value = 1
)
#> $id
#> [1] "a"
#>
#> $support
#> [1] "reals"
#>
#> $value
#> [1] 1
#>
#> $tags
#> NULL
#>
#> attr(,"class")
#> [1] "prm"
# Adding tags
prm(
id = "a",
support = "reals",
value = 1,
tags = c("tag1", "tag2")
)
#> $id
#> [1] "a"
#>
#> $support
#> [1] "reals"
#>
#> $value
#> [1] 1
#>
#> $tags
#> [1] "tag1" "tag2"
#>
#> attr(,"class")
#> [1] "prm"