components | R Documentation |
Decompose a firmly applied function (i.e., a function created by
firmly
):
firm_core
extracts the underlying “core”
function—the function that is called when all arguments are valid.
firm_checks
extracts the checks.
firm_error
extracts the subclass of the error condition that
is signaled when an input validation error occurs.
firm_args
extracts the names of arguments whose presence is to
be checked, i.e., those specified by the .warn_missing
switch of
firmly
.
firm_core(x)
firm_checks(x)
firm_error(x)
firm_args(x)
x |
Object to decompose. |
If x
is a firmly applied function:
firm_core
returns a function.
firm_checks
returns a data frame with components expr
(language), env
(environment), string
(character),
msg
(character).
firm_error
returns a character vector.
firm_args
returns a character vector.
In the absence of the component to be extracted, these functions return
NULL
.
firmly
f <- function(x, y, ...) NULL
f_fm <- firmly(f, ~is.numeric, list(~x, ~y - x) ~ {. > 0})
identical(firm_core(f_fm), f) # [1] TRUE
firm_checks(f_fm) # 4 x 4 data frame
firm_error(f_fm) # [1] "simpleError"
firm_args(f_fm) # NULL
firm_args(firmly(f_fm, .warn_missing = "y")) # [1] "y"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.