Skip to contents

specify_all_of() creates a function that will call stabilize_all_of() with the provided specs. specify_all_of()'s function requires that x satisfy every provided spec, and that all specs agree on the coerced result.

Usage

specify_all_of(...)

Arguments

...

Unnamed stabilizer functions, forwarded to stabilize_all_of().

Value

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

Examples

stabilize_a_then_b <- specify_all_of(
  specify_chr(regex = "^a"),
  specify_chr(regex = "b$")
)
stabilize_a_then_b("ab")
#> [1] "ab"
try(stabilize_a_then_b("ba"))
#> Error in eval(expr, envir) : 
#>   `"ba"` must match all of the provided stabilizers.
#> ✖ `"ba"` must match the regex pattern "^a"