
Flag a mostly-numeric column stored as text
Source:R/data_check_helpers.R
data_check_numeric_in_text.RdWhen a column read as character is mostly numbers but has a few values that do not parse (e.g. "n/a", ">100", "50 approx"), those dirty cells forced the whole column to text – a data-quality problem in the source, not a read error. A fully numeric text column is not flagged here: the file readers auto-type clean numeric columns, so an all-numeric character column would indicate a reader problem rather than a data problem.
Examples
data_check_numeric_in_text(c("1", "2", "3", "see note", "5"))$problem
#> [1] TRUE