Check the column types of a data.frame

CheckColumnTypes(df, coltypes)

Arguments

df

data.frame to check

coltypes

named list with the name of the columns to check as key and the required type as value

Value

NULL or throw an error if a wrong type is detected.

Examples

CheckColumnTypes( data.frame(string = c("A"), numeric = c(1), stringsAsFactors = FALSE), list(string = "character", numeric = "double") )
#> NULL