Description Usage Arguments Value Examples
View source: R/assert_colnames.R
Given a data.frame or data.table object, assert that all columns in the colnames argument exist as columns.
| 1 | assert_colnames(data, colnames, only_colnames = TRUE, quiet = FALSE)
 | 
| data | A data.frame or data.table | 
| colnames | Character vector with column names corresponding to columns in data | 
| only_colnames | Assert that the only columns in the data object should be those in colnames. Default = T. | 
| quiet | Do you want to suppress the printed message when a test is passed? Default = F. | 
Throws error if test is violated.
| 1 2 | assert_colnames(CO2, c("Plant","Type","Treatment","conc","uptake"))
assert_colnames(CO2, c("Plant","Type"), only_colnames=FALSE)
 | 
[1] "All column names present"
[1] "All column names present"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.