Check the column types of a data.frame
CheckColumnTypes(df, coltypes)
df | data.frame to check |
---|---|
coltypes | named list with the name of the columns to check as key and the required type as value |
NULL or throw an error if a wrong type is detected.
CheckColumnTypes( data.frame(string = c("A"), numeric = c(1), stringsAsFactors = FALSE), list(string = "character", numeric = "double") )#> NULL