Package 'saisdata'

Title: Course Data for the SAIS MIEF R Workshop
Description: Ready-to-use data for the two-day R workshop of the Master of International Economics and Finance (MIEF) at Johns Hopkins SAIS: the International Monetary Fund's World Economic Outlook of October 2026 as a tidy country panel, the same source in the IMF's own layout for its two largest country groups, and the World Bank's country groups. One line, library(saisdata), loads them all. The code is MIT licensed; the data keep their own terms, set out in the file LICENSE-data.md (the IMF's terms for statistical data, and CC BY 4.0 with the World Bank's added terms). This package is not an official IMF or World Bank product.
Authors: Teal Emery [aut, cre]
Maintainer: Teal Emery <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2026-11-06 23:15:58 UTC
Source: https://github.com/Teal-Insights/saisdata

Help Index


saisdata: course data for the SAIS MIEF R workshop

Description

Three datasets, ready to use once you run library(saisdata):

Details

  • weo: the IMF's World Economic Outlook of October 2026, one row per country (or IMF group) and year.

  • weo_groups: the same source for the IMF's two big country groups, laid out as the IMF publishes it, with the years across.

  • wb_groups: the World Bank's region, income level and lending type for 217 countries.

Type ?weo, or the name of any dataset after a question mark, to open its help page. vignette("saisdata") has a short worked example that runs offline.

The tables are a frozen snapshot. They do not change when the IMF or the World Bank publishes new numbers.

Credit

Print this line under every chart you make from these data:

Source: International Monetary Fund, World Economic Outlook Database, October 2026, https://data.imf.org/en/datasets/IMF.RES:WEO. Country groups: The World Bank: World Development Indicators: country and lending groups (CC BY 4.0). Net interest is the primary balance minus the overall balance, calculated for this workshop.

Drop the second sentence if your chart uses no World Bank groups, and the third if it shows no net interest.

Terms of use

The package's code and documentation are MIT licensed. That license does not cover the data. The data keep their own terms: the IMF's terms for statistical data for weo and weo_groups, and CC BY 4.0 with the World Bank's added terms for wb_groups. Each dataset's help page summarizes them. The full summary is in the file LICENSE-data.md, installed with the package; find it with system.file("LICENSE-data.md", package = "saisdata").

This package is not an official IMF or World Bank product.

Author(s)

Maintainer: Teal Emery [email protected]

Authors:

See Also

Useful links:


The World Bank's country groups: region, income level and lending type

Description

The World Bank's classification of 217 countries, as its data service served it on 3 November 2026. One row is one country, with its region, its income level and the World Bank lender it borrows from. There are no numeric units: every column is a code or a label. Join it to weo by code to compare countries by income level or region.

Usage

wb_groups

Format

A tibble with 217 rows and 6 variables:

code

chr The country's three-letter code, the same code the IMF uses, so it joins to the code column of weo.

wb_code

chr The World Bank's own code. It differs from code for two countries only: Kosovo (XKX) and West Bank and Gaza (PSE).

country

chr The country's name, as the World Bank writes it, such as "Egypt, Arab Rep.".

region

chr The World Bank's region, one of seven, such as "Sub-Saharan Africa" or "South Asia".

income_level

chr The World Bank's income level: "Low income", "Lower middle income", "Upper middle income" or "High income".

lending_type

chr Which World Bank lender the country borrows from: "IDA" (the concessional arm, for the poorest countries), "IBRD", "Blend" (both), or "Not classified".

Details

The World Bank revises income levels every 1 July, from each country's gross national income per person.

The table holds countries only, no aggregates, so a join to weo leaves out the IMF's group rows. 21 countries are here and not in the WEO, and one WEO country, Taiwan Province of China, is in the WEO and not here.

Vintage

The classification the World Bank's data service served on 3 November 2026. This table is a frozen snapshot: it does not change when the World Bank revises its groups.

Transformations

The World Bank's list came through wbwdi::wdi_get_entities(). The file data-raw/source/wb_country_groups.csv keeps the 217 countries and drops the World Bank's aggregates such as "Sub-Saharan Africa", renames the columns, and uses the IMF's codes for Kosovo (KOS) and West Bank and Gaza (WBG), so that one join matches every country. The World Bank's own code stays in wb_code. data-raw/wb_groups.R then changes no value.

Credit

Print this line under every chart you make from these data:

Source: International Monetary Fund, World Economic Outlook Database, October 2026, https://data.imf.org/en/datasets/IMF.RES:WEO. Country groups: The World Bank: World Development Indicators: country and lending groups (CC BY 4.0). Net interest is the primary balance minus the overall balance, calculated for this workshop.

Drop the third sentence if your chart shows no net interest.

Terms of use

The package's MIT license does not cover these data. The World Bank publishes them under the Creative Commons Attribution 4.0 International license (CC BY 4.0), with the added terms in its Terms of Use for Datasets, https://www.worldbank.org/ext/en/legal/terms-conditions/datasets (read on 6 November 2026). You may copy, share and adapt them, commercially too, if you credit the World Bank in its format, say what you changed and link to the license, https://creativecommons.org/licenses/by/4.0/. When you share the data, pass on the same attribution requirement; giving the web address of those terms is enough. Do not imply that the World Bank takes part in, sponsors or endorses your use. Disputes go to mediation and then arbitration. See system.file("LICENSE-data.md", package = "saisdata").

This package is not an official IMF or World Bank product.

Source

The World Bank: World Development Indicators: country and lending groups, https://datacatalog.worldbank.org/search/dataset/0037712/world-development-indicators, retrieved through wbwdi::wdi_get_entities() on 3 November 2026, CC BY 4.0. Built by data-raw/wb_groups.R from data-raw/source/wb_country_groups.csv.

See Also

weo, the panel this table joins to.

Examples

# The first six countries
head(wb_groups)

World Economic Outlook, October 2026: the tidy country panel

Description

Four indicators from the IMF's World Economic Outlook (WEO) database of October 2026, laid out tidy. One row is one entity in one year, and each variable has its own column. An entity is one of 197 countries or one of 13 IMF country groups, and the years run from 2000 to 2031, so the panel has 6,720 rows.

Usage

weo

Format

A tibble with 6,720 rows and 9 variables:

code

chr The entity's code. A country has its three-letter ISO code (the IMF uses KOS for Kosovo and WBG for West Bank and Gaza); an IMF group has a code that starts with G and a digit or an X, such as G110 for Advanced Economies.

name

chr The entity's name, as the IMF writes it, such as "Egypt, Arab Republic of".

year

int The year, 2000 to 2031.

gross_debt

dbl Gross debt of the general government, everything it owes, in percent of GDP (the IMF's GGXWDG_NGDP).

primary_balance

dbl The primary balance: revenue minus spending, with interest left out on both sides, in percent of GDP (GGXONLB_NGDP). Negative means a deficit.

overall_balance

dbl The overall balance: revenue minus all spending, interest included, in percent of GDP (GGXCNL_NGDP). Negative means a deficit.

gdp_usd_bn

dbl GDP at current prices, in billions of US dollars (NGDPD).

latest_actual

int The last year with actual fiscal data; later years are IMF estimates or projections. Missing (NA) for 12 of the 13 IMF groups.

fiscal_year

chr The months of the year the WEO shows the fiscal numbers in: "January/December" for most countries, and others such as "July/June" for Pakistan. Missing for 12 of the 13 IMF groups.

Details

The WEO mixes actual data and IMF projections in one row. latest_actual marks where the actual data stop. For most countries the fiscal numbers are actual through 2025, and from 2026 on almost every value is an IMF projection.

Net interest is not a column. It is one line of arithmetic, primary_balance - overall_balance: the interest the government pays minus the interest it receives, in percent of GDP. For Japan in 2025 that is -0.511 minus -0.709, which is 0.198.

To tell a group from a country, look at the code. An IMF group's code starts with G and then a digit or an X (G110); a country's second character is a letter (Ghana is GHA).

Vintage

The IMF's World Economic Outlook database of October 2026. This table is a frozen snapshot of that release: it does not change when the IMF publishes a new WEO or revises these numbers.

Transformations

The IMF's workbook WEOOct2026all.xlsx went through two steps. First, an extract stacked its Countries and Country Groups sheets, kept 13 of 44 indicators, the years 2000 to 2031 and 9 of 29 descriptive columns, and wrote each number in its shortest form. Second, data-raw/weo_panel.R kept the four indicators here, gave them plain names, reshaped them to one row per entity and year, and rounded them to three decimals. It also added two columns from the IMF's labels. fiscal_year is the IMF's own label. latest_actual turns the IMF's label, such as FY2024/25, into one calendar year, following the rule in the IMF's notes for that country.

Credit

Print this line under every chart you make from these data:

Source: International Monetary Fund, World Economic Outlook Database, October 2026, https://data.imf.org/en/datasets/IMF.RES:WEO. Country groups: The World Bank: World Development Indicators: country and lending groups (CC BY 4.0). Net interest is the primary balance minus the overall balance, calculated for this workshop.

Drop the second sentence if your chart uses no World Bank groups, and the third if it shows no net interest.

Terms of use

The package's MIT license does not cover these data. They are under the special terms for statistical data on the IMF's Copyright and Usage page, https://www.imf.org/en/About/copyright-and-terms (effective 11 October 2024, read on 6 November 2026), which name the World Economic Outlook database. You may download, extract, copy, build on, publish and distribute the data if you credit the IMF in the form above, do not alter the data in a way that intentionally affects their nature or accuracy, and say so next to the credit when you materially transform them. If you pass the data on, make reasonable efforts to tell your users about these terms. The IMF gives no warranty. For any potential commercial reuse, ask [email protected] first. The IMF's general terms still apply where the data terms are silent: imply no endorsement, and do not use its content to train large language models without its explicit permission. See system.file("LICENSE-data.md", package = "saisdata").

This package is not an official IMF or World Bank product.

Source

International Monetary Fund, World Economic Outlook Database, October 2026, https://data.imf.org/en/datasets/IMF.RES:WEO. Built by data-raw/weo.R from data-raw/source/weo_panel.csv, which data-raw/weo_panel.R makes from data-raw/source/weo_2026oct_extract.csv, an extract of the IMF's workbook WEOOct2026all.xlsx.

See Also

weo_groups for the IMF's own layout of its two big groups; wb_groups to add the World Bank's income levels and regions.

Examples

# Rows, then columns
dim(weo)

# The first six rows
head(weo)

# Kenya since 2020, with its net interest bill in percent of GDP
kenya <- subset(weo, code == "KEN" & year >= 2020 & year <= 2025)
kenya$net_interest <- kenya$primary_balance - kenya$overall_balance
kenya[, c("year", "gross_debt", "net_interest")]

World Economic Outlook, October 2026: the two big groups, as the IMF lays them out

Description

Six rows from the IMF's World Economic Outlook (WEO) database of October 2026, in the layout the IMF publishes. One row is one country group and one indicator, with the years across as columns. The two groups, Advanced Economies and Emerging Market and Developing Economies, together cover the world. The three indicators, the primary balance, the overall balance and GDP, are all you need to work out what the world's governments pay in interest.

Usage

weo_groups

Format

A tibble with 6 rows and 36 variables:

group_code

chr The IMF's code for the group: G110 for Advanced Economies, G200 for Emerging Market and Developing Economies (COUNTRY.ID in the IMF's file).

group

chr The group's name, as the IMF writes it (COUNTRY).

indicator

chr The IMF's code for the indicator (INDICATOR.ID): GGXONLB_NGDP is the primary balance, GGXCNL_NGDP the overall balance, and NGDPD GDP at current prices.

indicator_name

chr The indicator's full name, as the IMF writes it (INDICATOR), such as "Net lending (+) / net borrowing (-), General government, Percent of GDP".

units

chr How to read the numbers: "Percent of GDP" for the two balances and "Billions of US dollars" for GDP (the IMF's SCALE and UNIT columns, in plain words).

2001 to 2031

dbl One column per year, holding the indicator's value that year. From 2026 on the values are IMF projections. The names are numbers, so wrap them in backticks when you use them: `2025`.

Details

This is what data look like in the wild. To work with them in R you tidy them first: tidyr::pivot_longer() turns the year columns into rows, and tidyr::pivot_wider() turns the indicators into columns.

Net interest in billions of US dollars is the primary balance minus the overall balance, times GDP, divided by 100. Added up over the two groups it comes to about USD 849 billion in 2001 and USD 2,371.2 billion in 2025. The groups' balances are averages of their members' balances, weighted by GDP, so this total is an approximation.

The years start in 2001, the first year the IMF gives a primary balance for both groups.

Vintage

The IMF's World Economic Outlook database of October 2026. This table is a frozen snapshot of that release: it does not change when the IMF publishes a new WEO or revises these numbers.

Transformations

The IMF's workbook WEOOct2026all.xlsx went through two steps. First, an extract stacked its Countries and Country Groups sheets, kept 13 of 44 indicators, the years 2000 to 2031 and 9 of 29 descriptive columns, and wrote each number in its shortest form. Second, data-raw/weo_groups.R kept these six rows and the years 2001 to 2031, renamed five columns, and wrote the IMF's SCALE and UNIT in plain words. No number was changed.

Credit

Print this line under every chart you make from these data:

Source: International Monetary Fund, World Economic Outlook Database, October 2026, https://data.imf.org/en/datasets/IMF.RES:WEO. Country groups: The World Bank: World Development Indicators: country and lending groups (CC BY 4.0). Net interest is the primary balance minus the overall balance, calculated for this workshop.

Drop the second sentence if your chart uses no World Bank groups, and the third if it shows no net interest.

Terms of use

The package's MIT license does not cover these data. They are under the special terms for statistical data on the IMF's Copyright and Usage page, https://www.imf.org/en/About/copyright-and-terms (effective 11 October 2024, read on 6 November 2026), which name the World Economic Outlook database. You may download, extract, copy, build on, publish and distribute the data if you credit the IMF in the form above, do not alter the data in a way that intentionally affects their nature or accuracy, and say so next to the credit when you materially transform them. If you pass the data on, make reasonable efforts to tell your users about these terms. The IMF gives no warranty. For any potential commercial reuse, ask [email protected] first. The IMF's general terms still apply where the data terms are silent: imply no endorsement, and do not use its content to train large language models without its explicit permission. See system.file("LICENSE-data.md", package = "saisdata").

This package is not an official IMF or World Bank product.

Source

International Monetary Fund, World Economic Outlook Database, October 2026, https://data.imf.org/en/datasets/IMF.RES:WEO. Built by data-raw/weo_groups.R from data-raw/source/weo_2026oct_extract.csv, an extract of the IMF's workbook WEOOct2026all.xlsx.

See Also

weo for every country and group, one row per entity and year.

Examples

# Six rows: two groups times three indicators
nrow(weo_groups)

# Five columns that describe each row, then one column per year
names(weo_groups)