Skip to contents

When 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.

Usage

data_check_numeric_in_text(x, threshold = 0.8, n_max = 10)

Arguments

x

a character or factor vector

threshold

minimum fraction of non-empty values that must parse as numeric for the column to be considered "mostly numeric"

n_max

max number of non-numeric values to list

Value

list(problem, message, values)

Author

Daniel Lakens and Levi Baruch

Examples

data_check_numeric_in_text(c("1", "2", "3", "see note", "5"))$problem
#> [1] TRUE