powered by
Finds the elements that cannot be converted to numeric in a character vector. Useful when setting the strategy to clean numeric values.
check_nonnum( x, return_idx = FALSE, show_unique = TRUE, max_count = NULL, random_sample = FALSE, fix_len = FALSE )
The (unique) elements that cannot be converted to numeric, and their indexes if return_idx is TRUE.
return_idx
TRUE
A string vector that stores numerical values.
A logical value. If TRUE, return the index of the elements that are not numeric.
A logical value. If TRUE, return the unique elements that are not numeric. Omitted if return_idx is TRUE.
An integer. The maximum number of elements to show. If NULL or 0, show all elements. Omitted if return_idx is TRUE.
NULL
0
A logical value. If TRUE, randomly sample the elements to show. Only works if max_count is not NULL or 0.
max_count
A logical value. If TRUE, fill the vector with NA to fix the length to max_count.
NA
The function uses the as.numeric() function to try to convert the elements to numeric. If the conversion fails, the element is considered non-numeric.
as.numeric()
check_nonnum(c("\uFF11\uFF12\uFF13", "11..23", "3.14", "2.131", "35.2."))
Run the code above in your browser using DataLab