country_input_type {priceR} | R Documentation |
Determines whether country input is a country name or iso2Code
Description
Determines whether a string is a country name, an iso2Code, or invalid (not a World Bank API country/region)
Usage
country_input_type(country_input, countries_dataframe)
Arguments
country_input |
A country/region the user wishes to validate (string) E.g. "Australia". |
countries_dataframe |
A dataframe containing available iso2Code and country_name (see show_countries()). |
Value
A character vector
Examples
## Not run:
# Assign so as to save on API calls - recommended
countries_dataframe <- show_countries()
country <- "Australia"
country_input_type(country, countries_dataframe)
# [1] "country_name"
country <- "AU"
country_input_type(country, countries_dataframe)
# [1] "iso2Code"
country <- "something other than a valid country name or iso2Code"
country_input_type(country, countries_dataframe)
# [1] "invalid"
## End(Not run)
[Package priceR version 1.0.1 Index]