Skip to contents

Provides a clearer error message in the case of missing variable.

Usage

assert_colnames(df, x, null_ok = TRUE)

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) can x 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)
}