Description Usage Arguments Value Examples
View source: R/assert_coltypes.R
Given a data.frame or data.table object, assert that all columns in the names of the coltypes argument match the types of the elements of the coltypes argument.
| 1 | assert_coltypes(data, coltypes, quiet = FALSE)
 | 
| data | A data.frame or data.table | 
| coltypes | List with names corresponding to columns in data. The types of the columns in data will be tested against types of the elements in coltypes. | 
| quiet | Do you want to suppress the printed message when a test is passed? Default = F. | 
Throws error if test is violated.
| 1 2 3 4 5 6 7 | # Should pass
assert_coltypes(CO2, list(Plant = integer(), conc = double()))
# Should fail
## Not run: 
  assert_coltypes(CO2, list(Plant = character(), conc = character()))
## End(Not run)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.