specify_one_of() creates a function that will call stabilize_one_of()
with the provided specs. specify_one_of()'s function requires that
exactly one of the provided specs succeeds.
Arguments
- ...
Unnamed stabilizer /
to_*/specify_*()specs, forwarded tostabilize_one_of().
Value
A function of class "stbl_specified_fn" that calls
stabilize_one_of() with the provided specs. The generated function will
also accept ... for additional unnamed specs to pass to
stabilize_one_of(). You can copy/paste the body of the resulting
function if you want to provide additional context or functionality.
See also
Other specification functions:
specify_all_of(),
specify_any_of(),
specify_chr(),
specify_date(),
specify_dbl(),
specify_df(),
specify_dttm(),
specify_dur(),
specify_each(),
specify_fct(),
specify_int(),
specify_lgl(),
specify_lst(),
specify_time()
Examples
stabilize_int_xor_chr <- specify_one_of(stabilize_int, stabilize_chr)
stabilize_int_xor_chr("a")
#> [1] "a"
try(stabilize_int_xor_chr("1"))
#> Error in eval(expr, envir) :
#> `"1"` must match exactly one of the provided specifications, but matched
#> 2.
#> ℹ Matched specifications: "<fn>" (1) and "<fn>" (2)