as_country_name converts a vector of standardized country codes to
A character, factor, or numeric vector of country codes or names
Language code of country names desired. Defaults to
Code format from which to convert. Defaults to
Whether to use short alternative name when available. Can be
length 1 or the same length as
Whether to use variant alternative name when available. Can
be length 1 or the same length as
as_country_name takes a character, factor, or numeric vector of country
codes (or names in another standardized format) and converts them to
country names in the specified format. If you are trying to standardize an
existing set of names, see
from Unicode Common Locale Data Repository (CLDR),
which aspires to use the most customary name
e.g. "Switzerland" instead of official ones, which are frequently awkward for
common usage, e.g. "Swiss Confederation". CLDR also supplies names in a huge
variety of languages, allowing for easy translation. Short and variant
alternates are available for some countries; if not, the function will fall
Other name sets are available from
the UN Statistics Division(UNSD),
which maintains standardized names in English, Chinese, Russian, French,
Spanish, and Arabic, here named as
"en_cia", which include many longer official forms and shorter
"en_cia_local", which includes transliterations, and
"en_cia_abbreviation", which includes commonly-used abbreviations.
codes for all options, or run
DT::datatable(codes) for a
A character or factor vector of country names. Warns if new
values are added.
1 2 3 4 5 6 7 8
# Usable names for tough-to-standardize places as_country_name(c("US", "TW", "MM", "XK", "KR")) # If passed a factor, will return a releveled one as_country_name(factor(c("US", "NF", "CD", "SJ")), short = FALSE, variant = TRUE) # Speaks a lot of languages, knows a lot of codes as_country_name(c("SAH", "PCN", "OMA", "JPN"), from = "fifa", to = "cy") # to Welsh
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.