assert_coltypes: Assert that a data.frame's columns are certain types
Description
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.
Usage
assert_coltypes(data, coltypes, quiet = FALSE)
Arguments
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.
# NOT RUN {# Should passassert_coltypes(CO2, list(Plant = integer(), conc = double()))
# Should fail# }# NOT RUN { assert_coltypes(CO2, list(Plant = character(), conc = character()))
# }