ipc_get_analyses {ripc}R Documentation

Get analyses resources from the IPC API

Description

Accesses the areas resources on the IPC API. Contains detailed analysis information. If country, year and/or type parameters are passed, accesses the analyses simplified API endpoint and pulls in all analyses or filtered to those parameters. To get the details for a specific analysis available on the analyses/{id}/{period} advanced API endpoint, pass in id. You cannot pass in both sets of parameters.

Usage

ipc_get_analyses(
  country = NULL,
  year = NULL,
  type = NULL,
  id = 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 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.

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

Analyses data is metadata related to specific analyses conducted by the IPC, including title of the analysis, link to its release page on the IPC website, and creation/modification dates.

Value

Data frame of analysis metadata. 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 analysis:

  1. The data is arranged by country, year, and created.

  2. id column is renamed to be analysis_id.

Examples


# get all analyses details from the simplified API
ipc_get_analyses()

# get analysis details for a specific analysis ID
ipc_get_analyses(id = 12856213)


[Package ripc version 0.3.0 Index]