new-param | R Documentation |
These functions are used to construct new parameter objects. Generally,
these functions are called from higher level parameter generating functions
like mtry()
.
new_quant_param(
type = c("double", "integer"),
range = NULL,
inclusive = NULL,
default = deprecated(),
trans = NULL,
values = NULL,
label = NULL,
finalize = NULL,
...,
call = caller_env()
)
new_qual_param(
type = c("character", "logical"),
values,
default = deprecated(),
label = NULL,
finalize = NULL,
...,
call = caller_env()
)
An object of class "param"
with the primary class being either
"quant_param"
or "qual_param"
. The range
element of the object
is always converted to a list with elements "lower"
and "upper"
.
# Create a function that generates a quantitative parameter
# corresponding to the number of subgroups.
num_subgroups <- function(range = c(1L, 20L), trans = NULL) {
new_quant_param(
type = "integer",
range = range,
inclusive = c(TRUE, TRUE),
trans = trans,
label = c(num_subgroups = "# Subgroups"),
finalize = NULL
)
}
num_subgroups()
num_subgroups(range = c(3L, 5L))
# Custom parameters instantly have access
# to sequence generating functions
value_seq(num_subgroups(), 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.