Param {ParamHelpers} | R Documentation |
Create a description object for a parameter.
Description
For each parameter type a special constructor function is available, see below.
For the following arguments you can also pass an expression
instead of a
concrete value: default
, len
, lower
, upper
, values
. These
expressions can depend on arbitrary symbols, which are later filled in /
substituted from a dictionary, in order to produce a concrete valu, see
evaluateParamExpressions()
. So this enables data / context dependent
settings, which is sometimes useful.
The S3 class is a list which stores these elements:
- id (
character(1)
) See argument of same name.
- type (
character(1)
) Data type of parameter. For all type string see (getTypeStringsAll())
- len (
integer(1)
|expression
) See argument of same name.
- lower (
numeric
|expression
) See argument of same name. Length of this vector is
len
.- upper (
numeric
|expression
) See argument of same name. Length of this vector is
len
.- values (
list
|expression
) Discrete values, always stored as a named list.
- cnames (
character
See argument of same name.
- allow.inf (
logical(1)
) See argument of same name.
- trafo (
NULL
|function(x)
) See argument of same name.
- requires (
NULL
|expression
) See argument of same name.
- default (any concrete value |
expression
) See argument of same name.
- has.default (
logical(1)
) Extra flag to really be able to check whether the user passed a default, to avoid troubles with
NULL
andNA
.- tunable (
logical(1)
) See argument of same name.
- special.vals (
list
) See argument of same name.
Usage
makeNumericParam(
id,
lower = -Inf,
upper = Inf,
allow.inf = FALSE,
default,
trafo = NULL,
requires = NULL,
tunable = TRUE,
special.vals = list()
)
makeNumericVectorParam(
id,
len,
lower = -Inf,
upper = Inf,
cnames = NULL,
allow.inf = FALSE,
default,
trafo = NULL,
requires = NULL,
tunable = TRUE,
special.vals = list()
)
makeIntegerParam(
id,
lower = -Inf,
upper = Inf,
default,
trafo = NULL,
requires = NULL,
tunable = TRUE,
special.vals = list()
)
makeIntegerVectorParam(
id,
len,
lower = -Inf,
upper = Inf,
cnames = NULL,
default,
trafo = NULL,
requires = NULL,
tunable = TRUE,
special.vals = list()
)
makeLogicalParam(
id,
default,
requires = NULL,
tunable = TRUE,
special.vals = list()
)
makeLogicalVectorParam(
id,
len,
cnames = NULL,
default,
requires = NULL,
tunable = TRUE,
special.vals = list()
)
makeDiscreteParam(
id,
values,
trafo = NULL,
default,
requires = NULL,
tunable = TRUE,
special.vals = list()
)
makeDiscreteVectorParam(
id,
len,
values,
trafo = NULL,
default,
requires = NULL,
tunable = TRUE,
special.vals = list()
)
makeFunctionParam(
id,
default = default,
requires = NULL,
special.vals = list()
)
makeUntypedParam(
id,
default,
requires = NULL,
tunable = TRUE,
special.vals = list()
)
makeCharacterParam(id, default, requires = NULL, special.vals = list())
makeCharacterVectorParam(
id,
len,
cnames = NULL,
default,
requires = NULL,
special.vals = list()
)
Arguments
id |
( |
lower |
( |
upper |
( |
allow.inf |
( |
default |
(any concrete value | |
trafo |
( |
requires |
( |
tunable |
( |
special.vals |
( |
len |
( |
cnames |
( |
values |
( |
Value
[Param()
].
Examples
makeNumericParam("x", lower = -1, upper = 1)
makeNumericVectorParam("x", len = 2)
makeDiscreteParam("y", values = c("a", "b"))
makeCharacterParam("z")