getParamLengths: Return lengths of single parameters or parameters in...

Description Usage Arguments Value Examples

View source: R/getParamLengths.R

Description

Useful for vector parameters.

Usage

1

Arguments

par

(Param | ParamSet)
Parameter or parameter set.

dict

(environment | list | NULL)
Environment or list which will be used for evaluating the variables of expressions within a parameter, parameter set or list of parameters. The default is NULL.

Value

(integer). Named and in the same order as the input for ParamSet() input.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
ps = makeParamSet(
  makeNumericParam("u"),
  makeIntegerParam("v", lower = 1, upper = 2),
  makeDiscreteParam("w", values = 1:2),
  makeDiscreteVectorParam("x", len = 2, values = c("a", "b"))
)
getParamLengths(ps)
# the length of the vector x is 2, for all other single value parameters the length is 1.

par = makeNumericVectorParam("x", len = expression(k), lower = 0)
getParamLengths(par, dict = list(k = 4))

ParamHelpers documentation built on March 26, 2020, 7:40 p.m.