
Get Key Country Information from the REST Countries API
Source:R/get_country_info.R
get_country_info.Rd
Retrieves selected, essential information about Argentina or any other country by its full name. The data is retrieved from the REST Countries API. See the API documentation at https://restcountries.com/. Example API usage: https://restcountries.com/v3.1/name/argentina?fullText=true.
Value
A data frame with 8 columns:
name_common
: Common name of the country.name_official
: Official name of the country.capital
: Capital city.region
: Geographic region.subregion
: Subregion.population
: Total population.area
: Total area in square kilometers.languages
: Official languages, separated by commas.
Details
This function returns readable details such as the country's common and official name, capital, region, subregion, population, area, and official languages.
The function sends a GET request to the REST Countries API. If the request is successful (HTTP 200),
it parses the JSON and extracts the key fields. If the country is not found or there's an error,
the function returns NULL
with a user-friendly message.