Ensures a minimal set of columns exists in the dataset; otherwise throws an error listing the missing names.
Arguments
- df
Input data.frame/tibble to validate.
- required
Character vector of required column names to check for.
- nd_policy
Policy for censored values (ND/<LD/<LOQ) when required columns are not numeric. One of:
"ld2" (default): use half the detection limit
"ld" : use the detection limit
"zero" : replace with 0
"na" : replace with NA
Examples
df_ex <- data.frame(
ph = 7, turbidez = 2, od = 7, dbo = 3,
nt_total = 0.8, p_total = 0.05, tds = 150,
temperatura = 24, coliformes = 200
)
validate_wq(df_ex)
#> ph turbidez od dbo nt_total p_total tds temperatura coliformes
#> 1 7 2 7 3 0.8 0.05 150 24 200