replace_non_ascii: Replace Common Non-ASCII Characters

Description Usage Arguments Value Examples

Description

Replaces common non-ascii characters.

Usage

1
replace_non_ascii(x, remove.nonconverted = TRUE, ...)

Arguments

x

The text variable.

remove.nonconverted

logical. If TRUE unmapped encodings are deleted from the string.

...

ignored.

Value

Returns a text variable (character sting) with non-ascii characters replaced.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
x <- c(
    "Hello World", "6 Ekstr\xf8m", "J\xf6reskog", "bi\xdfchen Z\xfcrcher",
    'This is a \xA9 but not a \xAE', '6 \xF7 2 = 3', 'fractions \xBC, \xBD, \xBE',
    'cows go \xB5', '30\xA2'
)
Encoding(x) <- "latin1"
x

replace_non_ascii(x)
replace_non_ascii(x, remove.nonconverted = FALSE)

trinker/textcleanLite documentation built on June 1, 2019, 12:52 a.m.