check_class | R Documentation |
This function checks that the class of an input to a parent function is appropriate. If not, the function either produces a helpful error message or returns a warning.
check_class(
arg = deparse(substitute(input)),
input,
if_class = NULL,
to_class,
type = "stop",
coerce_input
)
arg |
A character string which defines the argument of the parent function. |
input |
The input to an argument of a parent function. |
if_class |
(optional) A character vector of object class(es). If supplied, the function will only proceed to check the class of the object if the |
to_class |
The required class of the input. |
type |
A character which specifies whether to return an error ( |
coerce_input |
A function used to coerce |
The function checks the class of the input. If the class is not the same as required by the parent function (i.e., as specified by to_class
), the function returns a helpful error message, or a warning and an object whose class has been coerced to the correct class.
Edward Lavender
This function is taken from the ‘utils.add’ package (https://github.com/edwardlavender/utils.add). It is defined separately in flapper
to reduce reliance on non-default packages.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.