View source: R/is_satisfying_funcs.R
is_satisfying_funcs | R Documentation |
Checks if a passed value satisfies one or more tests provided as functions.
is_satisfying_funcs(value, func_or_list)
value |
the value to verify |
func_or_list |
a function or (optionally named) list of functions. The function must accept a single argument (which will receive the value) and return either a logical (TRUE or FALSE), or an instance of qscheck::report. |
## Not run:
qscheck::assert(
qscheck::is_satisfying_funcs(
my_parameter,
list(
more_than_five = function(x) {
# Short form. Returns a logical
x > 5
},
less_than_two = function(x) {
# expanded form. use success() and failure(reason)
if (x < 2) {
return(success())
} else {
return(failure("Value must be less than two"))
}
}
)
)
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.