[API] OECD

API & Databases R Courses

Access OECD countries and selected non-member economies data through the OECD API.

Thierry Warin https://warin.ca/aboutme.html (HEC Montréal and CIRANO (Canada))https://www.hec.ca/en/profs/thierry.warin.html
06-01-2020

Database description

The Organisation for Economic Co-operation and Development (OECD) is an intergovernmental economic organisation with 36 member countries. It is a forum of countries providing a platform to compare policy experiences, seek answers to common problems, identify good practices and coordinate domestic and international policies of its members.

OECD : https://www.oecd.org/about/

Functions

Each of these functions are detailed in this course and some examples are provided.

search_dataset()

The function search_dataset() searches for OECD indicators. It takes as an input the indicator that would be useful for your analysis. It searches and returns a table of all the available indicator related to the input inserted.

# Loading OECD library
library(OECD)

# List all available datasets
dataset_list <- get_datasets()

# Search all indicators with the term "unemployment"
search_dataset("unemployment", data = dataset_list)

get_data_structure()

The function get_data_structure takes as an input the id associate with the dataset and returns the structure of any query made with the OECD package.

# Structure of a query
dstruc <- get_data_structure("DUR_D")
str(dstruc, max.level = 1)

get_datasets()

The function get_datasets takes as an input the dataset id and filters. Add a variable to list all of the specific filters allows to simplify the input of the function. get_datasets returns a dataframe containing the selected data.

# Filter use to narrow the research (Canada-Germany-France-USA; male and female; 20-24 years old)
filter_list <- list(c("DEU", "FRA", "CAN", "USA"), "MW", "2024")

# Dataframe containing selected data
unemployementOECD <- get_dataset(dataset = "DUR_D", filter = filter_list)
unemployementOECD[1:6,]

tl;dr

# Loading OECD library
library(OECD)

# List all available datasets
dataset_list <- get_datasets()

# Search all indicators with the term "unemployment"
search_dataset("unemployment", data = dataset_list)

# Structure of a query
dstruc <- get_data_structure("DUR_D")
str(dstruc, max.level = 1)

# Filter use to narrow the research (Canada-Germany-France-USA; male and female; 20-24 years old)
filter_list <- list(c("DEU", "FRA", "CAN", "USA"), "MW", "2024")

# Dataframe containing selected data
unemployementOECD <- get_dataset(dataset = "DUR_D", filter = filter_list)
unemployementOECD[1:6,]

Code learned this week

Command Detail
search_dataset() Search for OECD indicators
get_data_structure() Read the structure of any query made with the OECD package
get_datasets() Find data related to the indicators

References

This tutorial uses the OECD package documentation


Citation

For attribution, please cite this work as

Warin (2020, June 1). Thierry Warin, PhD: [API] OECD. Retrieved from https://warin.ca/posts/api-oecd/

BibTeX citation

@misc{warin2020[api],
  author = {Warin, Thierry},
  title = {Thierry Warin, PhD: [API] OECD},
  url = {https://warin.ca/posts/api-oecd/},
  year = {2020}
}