
Last chance! 50% off unlimited learning
Sale ends in
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.
latinize(x, encoding = "latin1")
The transliterated vector of the same length as x
. NA
s
are avoided.
A character vector.
Encoding that the strings in x
should be
converted to. If the conversion fails, defaults back to the original
encoding. Defaults to "latin1"
.
# 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