xfun (version 0.12)

is_ascii: Check if a character vector consists of entirely ASCII characters

Description

Converts the encoding of a character vector to 'ascii', and check if the result is NA.

Usage

is_ascii(x)

Arguments

x

A character vector.

Value

A logical vector indicating whether each element of the character vector is ASCII.

Examples

Run this code
# NOT RUN {
library(xfun)
is_ascii(letters)  # yes
is_ascii(intToUtf8(8212))  # no
# }

Run the code above in your browser using DataCamp Workspace