Intended to be called from data_check, prints a warning if there are rows in df_foreign with keys that aren't included in df_primary

data_foreign_key(df_foreign, df_primary, key)

Arguments

df_foreign

data frame: table that stores key as foreign

df_primary

data frame: table that stores key as primary

key

character: name of variable that acts as key

See also

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

Examples

library(dplyr) data(sale, cust) data_foreign_key(sale, cust, "cust_id") cust <- filter(cust, cust_id > 5) data_foreign_key(sale, cust, "cust_id")
#> Warning: cust: Primary key (cust_id) is missing 5 value(s) present in the sale table