Skip to contents

Rule order (ported from datacheck classify_col_type_rules()): all-NA -> empty; ID name pattern -> id; 1 unique -> constant; 2 unique -> binary; date-parseable -> date; long strings -> text; numeric -> continuous (or ambiguous integer, flagged for LLM); comma-decimal -> continuous variants.

Usage

data_col_type(col_name, values)

Arguments

col_name

the column's name (drives the ID-pattern rule)

values

the column's values (a vector)

Value

a list with col_type (a value from .data_check_col_types, or NA when only the LLM could decide), ambiguous (whether the LLM should be consulted), numeric_values (numeric vector for stats, or NULL), n_coerced, and is_numeric.

Examples

data_col_type("age", c(23, 45, 31, 29))
#> $col_type
#> [1] NA
#> 
#> $ambiguous
#> [1] TRUE
#> 
#> $numeric_values
#> [1] 23 45 31 29
#> 
#> $n_coerced
#> [1] NA
#> 
#> $is_numeric
#> [1] TRUE
#> 
data_col_type("subject_id", c("s01", "s02", "s03"))
#> $col_type
#> [1] "id"
#> 
#> $ambiguous
#> [1] FALSE
#> 
#> $numeric_values
#> NULL
#> 
#> $n_coerced
#> [1] NA
#> 
#> $is_numeric
#> [1] FALSE
#>