is_factor | R Documentation |
Check if the passed entity is a factor.
is_factor(
value,
exact_levels = NULL,
exact_length = NULL,
allow_null = FALSE,
allow_na_values = FALSE
)
value |
the value to check |
exact_levels |
vector of strings of the expected levels of the factor. The factor must contain *exactly* the specified elements. |
exact_length |
integer value. If passed, the factor must have the *exact* specified length. |
allow_null |
boolean. if TRUE, NULL is accepted as a valid value. If FALSE (default) do not accept it. |
allow_na_values |
boolean. If passed allows factors containing NAs. The length check is performed including the NA values. Default FALSE. |
## Not run:
# For assertion
assertthat::assert_that(qscheck::is_factor(my_parameter))
# For check
if (qscheck::is_factor(my_parameter)) {}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.