ipc_get_points {ripc}R Documentation

Get points resources from the IPC API

Description

Accesses the points resources on the IPC API. Contains detailed area and population data. If year and/or type parameters are passed, accesses the types simplified API endpoint and pulls in all types data or filtered to either year or type. To get all types for a specific analysis and period, available on the types/{id}/{period} advanced API endpoint, pass in id and period. You cannot pass in both sets of parameters.

Usage

ipc_get_points(
  year = NULL,
  type = NULL,
  id = NULL,
  period = NULL,
  api_key = NULL,
  tidy_df = TRUE
)

Arguments

year

Single numeric year to filter analysis, calculated from the maximum year of current period dates. If NULL, the default, returns data for all years.

type

Single string value of 'A' or 'C', corresponding to food security conditions, either acute or chronic. If NULL, the default, returns data for all types.

id

Analysis ID.

period

Period code, either 'C', 'P', or 'A' for current, projection, and second projection.

api_key

IPC API key. If NULL (the default), looks for IPC_API_KEY in the environment.

tidy_df

If TRUE, returns a tidy data frame wrangled as described in the Tidy section of the documentation. If FALSE, returns the data frame as returned direct from the IPC-CH API.

Details

Points data is IPC data generated from analysis on geographic entities that are smaller than the standard areas. These are typically urban areas or displacement sites where food insecurity conditions might differ significantly from the wider context and justify specific analysis. Population estimates as well as an overall phase classification are provided for each point. Data is currently output only for current periods through the points endpoint. Use ipc_get_population() to get detailed population data and classifications for all analysis periods. Points data is contained within the areas dataset returned from ipc_get_population().

See the IPC website and API documentation for more information.

Value

Data frame of IPC and CH analysis at the point 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 point analysis, and all estimates and values are stored as columns:

  1. All columns containing phase or population are converted to numeric.

  2. aar_id is renamed to area_id and anl_id to analysis_id.

Examples



# get all areas from the simplified API
ipc_get_points()

# get areas for specific analysis ID and period from advanced API
ipc_get_points(id = 18978466, period = "P")


[Package ripc version 0.3.1 Index]