uis_get {uisapi} | R Documentation |
Get data from the UIS API
Description
Retrieves data from the UNESCO Institute for Statistics (UIS) API for specified entities, indicators, and time periods.
Usage
uis_get(
entities = NULL,
indicators = NULL,
start_year = NULL,
end_year = NULL,
version = NULL
)
Arguments
entities |
Character vector. The entity IDs (ISO 3166-1 alpha-3 codes)
to retrieve data for. Must provide either this parameter or |
indicators |
Character vector. The indicator IDs to retrieve data for.
Must provide either this parameter or |
start_year |
Numeric or character. The starting year for the data retrieval period. If NULL, no start year constraint is applied. |
end_year |
Numeric or character. The ending year for the data retrieval period. If NULL, no end year constraint is applied. |
version |
Character. The API version to use. If NULL, the default version is used. See uis_get_versions for a list of supported versions. |
Value
A data frame with the following columns:
entity_id |
Character. The ID of the entity (geoUnit). |
indicator_id |
Character. The ID of the indicator. |
year |
Numeric. The year of the observation. |
value |
Numeric. The value of the indicator for the given entity and year. |
Examples
# Get all data for a single indicator
uis_get(
indicators = "CR.1"
)
# Get all data for a single country
uis_get(
entities = "BRA"
)
# Get data for multiple indicators and countries
uis_get(
entities = c("BRA", "USA"),
indicators = c("CR.1", "CR.2")
)
# Get data for multiple indicators and countries and specific time range
uis_get(
entities = c("BRA", "USA"),
indicators = c("CR.1", "CR.2"),
start_year = 2010,
end_year = 2020
)