ipc_get_country {ripc} | R Documentation |
Get country resources from the IPC API
Description
Accesses the country resources on the IPC API. Contains detailed
country-level data. If country
, year
and/or type
parameters are passed,
accesses the country simplified API endpoint and pulls in all country data
filtered to those parameters.
Usage
ipc_get_country(
country = NULL,
year = NULL,
type = NULL,
api_key = NULL,
tidy_df = TRUE
)
Arguments
country |
ISO2 country code. |
year |
Single numeric year to filter analysis, calculated from the
maximum year of current period dates. If |
type |
Single string value of 'A' or 'C', corresponding to food security
conditions, either acute or chronic. If |
api_key |
IPC API key. If |
tidy_df |
If |
Details
Country data is the highest level of aggregation for IPC analysis. Data is
the population estimates and other details aggregated from area and point
analyses within the country for that specific analysis. No phase
classifications are made at the country level. Data is currently output only
for current periods through the country endpoint. Use
ipc_get_population()
to get detailed population data for all analysis
periods.
See the IPC website and API documentation for more information.
Value
Data frame of IPC and CH analysis at the country level. Refer to the IPC-CH Public API documentation for details on the returned values, with variables described in full in the extended documentation.
Tidy
When tidy_df
is TRUE
, the following changes are made to the initial
output to ensure each row represents a single country analysis, and all estimates
and values are stored as columns:
-
analysis_period_start
andanalysis_period_end
created asDate
columns from thefrom
andto
columns respectively, allocating the day of the start and end periods to be the 15th of the month. -
id
column is renamed to beanalysis_id
.
Examples
# get all areas from the simplified API
ipc_get_country()
# get country data just for Somalia
ipc_get_country(country = "SO")