Learn R Programming

ParamHelpers (version 1.0-55)

paramValueToString: Convert a value to a string.

Description

For discrete parameter values always the name of the discrete value is used.

Usage

paramValueToString(par, x)

Arguments

par
[Param | ParamSet] Parameter or parameter set.
x
[any] Value for parameter or value for parameter set. In the latter case it must be list in the same order as the parameters in the set.

Value

  • [character(1)].

Examples

Run this code
p <- makeNumericParam("x")
paramValueToString(p, 1) # "1.00"
paramValueToString(p, 1.2345) # "1.23"

p <- makeIntegerVectorParam("x", length=2)
paramValueToString(p, c(1L, 2L)) # 1,2

p <- makeLogicalParam("x")
paramValueToString(p, TRUE) # "TRUE"

p <- makeDiscreteParam("x", values=list(a=NULL, b=2))
paramValueToString(p, NULL) # "a"

Run the code above in your browser using DataLab