Check if strings are column names of a data.frame
assert_colnames.Rd
Provides a clearer error message in the case of missing variable.
Arguments
- df
(
data.frame
) input to check for the presence of column names.- x
(vector of
character
) the names of the columns to be checked.- null_ok
(
logical
) canx
be NULL.
Examples
if (FALSE) {
assert_colnames(mtcars, c("speed", "seats"), null_ok = TRUE)
my_colnames <- NULL
assert_colnames(mtcars, my_colnames, null_ok = FALSE)
}