Skip to contents

This is a helper function for data checks. It checks if the dataframe df contains all the columns with names and types specified in structure.

Usage

check_dataframe_structure(df, structure)

Arguments

df

Dataframe

structure

Dataframe with two columns.

  1. Colname contains the colnames of df.

  2. Coltype contains the associated type to check for.

Value

TRUE if df contains all the columns specified in structure with the correct types.

Examples

df <- data.frame(Col1 = 1:5, Col2 = paste0("test", 1:5))
structure <- data.frame(Colname = c("Col1", "Col2"), Coltype = c("integer", "character"))
check_dataframe_structure(df, structure)
#> [1] TRUE