Learn R Programming

photon (version 0.3.5)

latinize: Latinization

Description

Helper tool to transliterate various encodings to latin. Attempts to convert a character vector from its current encoding to "latin1" and - if it fails - defaults back to the original term. This can be useful for geocode and structured when attempting to geocode terms containing symbols that photon does not support.

Usage

latinize(x, encoding = "latin1")

Value

The transliterated vector of the same length as x. NAs are avoided.

Arguments

x

A character vector.

encoding

Encoding that the strings in x should be converted to. If the conversion fails, defaults back to the original encoding. Defaults to "latin1".

Examples

Run this code
# converts fancy apostrophes to normal ones
latinize("Luatuanu\u2019u")

# does nothing
latinize("Berlin")

# also does nothing, although it would fail with `iconv`
latinize("\u0391\u03b8\u03ae\u03bd\u03b1")

Run the code above in your browser using DataLab