powered by
Given a data.frame or data.table object, assert that all columns in the colnames argument exist as columns.
assert_colnames(data, colnames, only_colnames = TRUE, quiet = FALSE)
A data.frame or data.table
Character vector with column names corresponding to columns in data
Assert that the only columns in the data object should be those in colnames. Default = T.
Do you want to suppress the printed message when a test is passed? Default = F.
Throws error if test is violated.
# NOT RUN { assert_colnames(CO2, c("Plant","Type","Treatment","conc","uptake")) assert_colnames(CO2, c("Plant","Type"), only_colnames=FALSE) # }
Run the code above in your browser using DataLab