data_check: Check standardized data (cust, lic, sale) formatting rules

Description Usage Arguments See Also Examples

View source: R/data-check.R

Description

Produces warnings if any checks fail (stays silent on success). This function is simply a wrapper for several calls to data_check_table and data_foreign_key. Rules are designed to ensure:

Usage

1

Arguments

cust

data frame: customer table (primary key = "cust_id")

lic

data frame: license types table (primary key = "lic_id")

sale

data frame: transactions table (foreign keys = "lic_id", "cust_id")

See Also

Other functions to check data format: data_check_table, data_foreign_key, data_internal, variable_allowed_values

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
library(dplyr)
data(cust, lic, sale)

# a successful check passes silently
data_check(cust, lic, sale)

# introduce some warnings
cust <- filter(cust, cust_id > 5)
cust <- bind_rows(cust, cust)
cust$res[1] <- "Canada"
lic$lic_id[1] <- NA
sale$month <- NULL
sale$year[1] <- "-2010"
sale$year[2] <- 0
data_check(cust, lic, sale)

southwick-associates/salic documentation built on Nov. 5, 2019, 9:13 a.m.