convert_parameters | R Documentation |
convert_parameters Applies a list of converters to each values on a list. If a value is modified during the conversion (successfull conversion) then, no further convert will be applied to this value, so values are only converted once.
convert_parameters(args, converters)
args |
a named list, which values will be converted. |
converters |
a vector of function. Each function will be applied to each values with the exception of values already converted by a previous converter. |
a named list
object with values converted by converters.
L.Pavot
boolean_converter <- function(x) {
return(if (x == "TRUE") TRUE else if (x == "FALSE") FALSE else x)
}
parameters <- W4MRUtils::convert_parameters(
list("x" = "TRUE"),
c(boolean_converter)
)
print(parameters$`some-parameter`)
## "TRUE" has becomes TRUE.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.