Skip to contents

specify_any_of() creates a function that will call stabilize_any_of() with the provided specs. specify_any_of()'s function tries each spec in order and returns the result of the first one that succeeds.

Usage

specify_any_of(...)

Arguments

...

Unnamed stabilizer / to_* / specify_*() specs, forwarded to stabilize_any_of().

Value

A function of class "stbl_specified_fn" that calls stabilize_any_of() with the provided specs. The generated function will also accept ... for additional unnamed specs to pass to stabilize_any_of(). You can copy/paste the body of the resulting function if you want to provide additional context or functionality.

Examples

stabilize_int_or_chr <- specify_any_of(specify_int(), specify_chr())
stabilize_int_or_chr(1L)
#> [1] 1
stabilize_int_or_chr("a")
#> [1] "a"
try(stabilize_int_or_chr(TRUE))
#> [1] 1