Converts the encoding of a character vector to 'ascii'
, and check if
the result is NA
.
Arguments
- x
A character vector.
Value
A logical vector indicating whether each element of the character
vector is ASCII.
Examples
library(xfun)
is_ascii(letters) # yes
#> [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
#> [16] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
is_ascii(intToUtf8(8212)) # no
#> [1] FALSE