Skip to contents

For each column whose resolved type is "numeric", computes the proportion of non-empty values that cannot be coerced to numeric. Returns "FAIL" when the rate exceeds max_non_numeric_rate (default 0.01), "WARN" when it exceeds warn_non_numeric_rate (default 0), and "PASS" otherwise. Both thresholds support per-column overrides via config$column_rules.

Usage

check_non_numeric(df, config, types = NULL)

Arguments

df

A data frame with all columns as character vectors (as returned by read_dataset).

config

Named list. Merged configuration as returned by load_config.

types

Optional named character vector of pre-resolved column types; see check_inferred_types.

Value

A list of dq_result objects, one per numeric column. Returns an empty list if no numeric columns are found.

Examples

cfg_dir <- system.file("demonstrations/config", package = "dqcheckr")
cfg  <- load_config("starwars_csv", config_dir = cfg_dir)
path <- system.file("demonstrations/data/starwars.csv", package = "dqcheckr")
df   <- read_dataset(path, cfg)
check_non_numeric(df, cfg)
#> [[1]]
#> [[1]]$check_id
#> [1] "QC-11"
#> 
#> [[1]]$check_name
#> [1] "Non-numeric values"
#> 
#> [[1]]$column
#> [1] "height"
#> 
#> [[1]]$status
#> [1] "PASS"
#> 
#> [[1]]$observed
#> [1] "0 non-numeric value(s) (0.00%)"
#> 
#> [[1]]$threshold
#> [1] "WARN >0.00%, FAIL >1.00%"
#> 
#> [[1]]$message
#> [1] "Column 'height' has no non-numeric values."
#> 
#> 
#> [[2]]
#> [[2]]$check_id
#> [1] "QC-11"
#> 
#> [[2]]$check_name
#> [1] "Non-numeric values"
#> 
#> [[2]]$column
#> [1] "mass"
#> 
#> [[2]]$status
#> [1] "PASS"
#> 
#> [[2]]$observed
#> [1] "0 non-numeric value(s) (0.00%)"
#> 
#> [[2]]$threshold
#> [1] "WARN >0.00%, FAIL >1.00%"
#> 
#> [[2]]$message
#> [1] "Column 'mass' has no non-numeric values."
#> 
#> 
#> [[3]]
#> [[3]]$check_id
#> [1] "QC-11"
#> 
#> [[3]]$check_name
#> [1] "Non-numeric values"
#> 
#> [[3]]$column
#> [1] "birth_year"
#> 
#> [[3]]$status
#> [1] "PASS"
#> 
#> [[3]]$observed
#> [1] "0 non-numeric value(s) (0.00%)"
#> 
#> [[3]]$threshold
#> [1] "WARN >0.00%, FAIL >1.00%"
#> 
#> [[3]]$message
#> [1] "Column 'birth_year' has no non-numeric values."
#> 
#>