Skip to contents

Ensures a minimal set of columns exists in the dataset; otherwise throws an error listing the missing names.

Usage

validate_wq(
  df,
  required = c("ph", "turbidez", "od", "dbo", "nt_total", "p_total", "tds",
    "temperatura", "coliformes")
)

Arguments

df

Input data frame / tibble.

required

Character vector of required column names.

Value

The input df if valid; otherwise, an error is thrown.

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