Check character vectors for non-ASCII characters or common NULL value placeholders.

chk_ascii(x)

chk_text_miss(x, miss = getOption("testdat.miss_text"))

chk_text_nmiss(x, miss = getOption("testdat.miss_text"))

Arguments

x

A vector to check.

miss

A vector of values to be treated as missing. The testdat.miss or testdat.miss_text option is used by default.

Value

A logical vector flagging records that have passed or failed the check.

Examples


chk_ascii(c("a", "\U1f642")) # detect non-ASCII characters
#> [1]  TRUE FALSE

imported_data <- c(1, "#n/a", 2, "", 3, NA)
chk_text_miss(imported_data)
#> [1] FALSE  TRUE FALSE  TRUE FALSE  TRUE
chk_text_nmiss(imported_data) # Equivalent to !chk_text_miss(imported_data)
#> [1]  TRUE FALSE  TRUE FALSE  TRUE FALSE