evaluateParamExpressions: Evaluates all expressions within a parameter.

Description Usage Arguments Value Examples

View source: R/evaluateParamExpressions.R

Description

Evaluates the expressions of a parameter, parameter set or list of parameters for a given dictionary.

Usage

1

Arguments

obj

(Param() | ParamHelpers::ParamSet() | list)
Parameter, parameter set or list of parameter values. Expressions within len, lower or upper boundaries, default or values will be evaluated using the provided dictionary (dict).

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

[Param() | ParamHelpers::ParamSet() | list].

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
ps = makeParamSet(
  makeNumericParam("x", lower = expression(p), upper = expression(ceiling(3 * p))),
  makeIntegerParam("y", lower = 1, upper = 2)
)
evaluateParamExpressions(ps, dict = list(p = 3))

ps = makeParamSet(
  makeNumericParam("x", default = expression(sum(data$Species == "setosa"))),
  makeIntegerParam("y", lower = 1, upper = 2),
  keys = c("data", "Species")
)
evaluateParamExpressions(ps, dict = list(data = iris))

par.vals = list(
  x = expression(k),
  y = 5
)
evaluateParamExpressions(par.vals, dict = list(k = 3))

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