Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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

library(xfun)
is_ascii(letters)  # yes
is_ascii(intToUtf8(8212))  # no

xfun

Miscellaneous Functions to Support Packages Maintained by 'Yihui Xie'

v0.22
MIT + file LICENSE
Authors
Yihui Xie [aut, cre, cph] (<https://orcid.org/0000-0003-0645-5666>), Wush Wu [ctb], Daijiang Li [ctb], Xianying Tan [ctb], Salim Brüggemann [ctb] (<https://orcid.org/0000-0002-5329-5987>), Christophe Dervieux [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.