translate: Translates Vector in English Without Accent

Description Usage Arguments Details Value Examples

View source: R/translate.R

Description

Translates string vector in English without accent using dictionary created and stored in the package by country and level of administrative boundaries.

Usage

1
translate(vect, hash, country = NULL, level = NULL)

Arguments

vect

a string chracter vector.

hash

a named UNICODE vector containing the translation

country

a character name of a country.

level

a numeric, 1 for admin1 (province), 2 for admin2 (district), 3 for city/commune.

Details

The functions accepts two types of entry for translation.
1. You can use the country and level information to translate vector, but only for Vietnam, Cambodia and Thailand. 2 . You can directly input a named vector in UNICODE containing the translation. If the argument hash is NULL, the vector will be return encoded in UNICODE.

Value

String vector of the same length as input in vect argument

Examples

1
2
3
4
# to translate province name of Vietnam in English
translate(c("AnGiang", "Ha Noi"), vn_admin1)
# or
translate(c("AnGiang", "Ha Noi"), country = "Vietnam", level = 1)

choisy/dictionary documentation built on Aug. 21, 2019, 3:52 p.m.