vt_header: Validate that a CSV Has a Header

View source: R/vt_header.R

vt_headerR Documentation

Validate that a CSV Has a Header

Description

vt_header - Validates that a .csv file's data.frame contains no missing/null values in required fields.

Usage

vt_header(data, map, file_name = NULL)

Arguments

data

data.frame.

map

A data.frame with a header (header name) & required (logical,; Is column required?).

file_name

An optional file name for use in reporting.

Value

Returns a list of validation results.

Examples

set.seed(10)
map <- data.frame(
    header = colnames(mtcars),
    required = sample(c(TRUE, FALSE), ncol(mtcars), TRUE), stringsAsFactors = FALSE
)

df <- mtcars; colnames(df) <- mtcars[1, ]
vt_header(df, map)
str(vt_header(df, map))

data-steve/valiData documentation built on Feb. 3, 2023, 12:21 a.m.