convert_to_iso2Code {priceR} | R Documentation |
Convert any country input into its iso2Code
Description
'convert_to_iso2Code' accepts the type of country input and the country, and returns the relevant iso2Code
Usage
convert_to_iso2Code(country_input_type_string, country, countries_dataframe)
Arguments
country_input_type_string |
Either "country_name" or "iso2Code" - use country_input_type(country, countries_dataframe) to determine or assign manually. |
country |
A country/region name or iso2Code. |
countries_dataframe |
The output of show_countries() |
Value
A character vector containing a valid iso2Code
Examples
## Not run:
# Assign so as to save on API calls (recommended)
countries_dataframe <- show_countries()
country <- "Australia"
country_input_type_string <- country_input_type(country, countries_dataframe)
convert_to_iso2Code(country_input_type_string, country, countries_dataframe)
# [1] "AU"
country <- "AU"
country_input_type_string <- country_input_type(country, countries_dataframe)
convert_to_iso2Code(country_input_type_string, country, countries_dataframe)
# [1] "AU"
## End(Not run)
[Package priceR version 1.0.1 Index]