checkValues: Check user-supplied values are from set of permissable values

View source: R/runTime.R

checkValuesR Documentation

Check user-supplied values are from set of permissable values

Description

This function may be used in code generated by reading the WADL and is for cases where a parameter in the REST method has a fixed set of possible values. This function verifies that the user-supplied values are in this set and raises an error otherwise.

In the future, it may return corrected values.

Usage

checkValues(value, options, varName = deparse(value), repeating = FALSE)

Arguments

value

a character vector of the user-supplied values.

options

the set of permitted values; a character vector

varName

the name of the variable being matched. Potentially used in the error message.

repeating

whether we can have more than one value in value, i.e. the method allows several values rather than just one.

Value

The expanded version of value, i.e. with any abbreviations replaced by their full form from options.

Author(s)

Duncan Temple Lang

See Also

match.arg

Examples

 checkValues("Jan", c("January", "February", "March"))

 try(checkValues("Jn", c("January", "February", "March"), "month"))

duncantl/WADL documentation built on Nov. 23, 2023, 4:28 p.m.