Learn R Programming

flownet (version 0.2.1)

africa_trade: Intra-African Trade Flows by HS Section

Description

A dataset containing bilateral trade flows between 47 African countries, aggregated by HS (Harmonized System) section. Values represent annual averages over 2012-2022 from the CEPII BACI database (HS96 nomenclature).

Usage

data(africa_trade)

Arguments

Format

A data.table with 27,721 rows and 8 columns:

iso3_o

Factor. Exporter (origin) country ISO 3166-1 alpha-3 code (47 countries).

iso3_d

Factor. Importer (destination) country ISO 3166-1 alpha-3 code (47 countries).

section_code

Integer. HS section code (1 to 21).

section_name

Factor. HS section description (21 categories, e.g., "Live animals and animal products", "Mineral products", "Machinery and mechanical appliances...").

hs2_codes

Factor. Comma-separated HS 2-digit codes within the section (e.g., "84, 85" for machinery).

value

Numeric. Trade value in thousands of USD (current prices).

value_kd

Numeric. Trade value in thousands of constant 2015 USD.

quantity

Numeric. Trade quantity in metric tons.

Details

The dataset provides bilateral trade flows aggregated from HS 6-digit product codes (via HS 2-digit) to 21 HS sections. Trade values and quantities are annual averages computed over the 2012-2022 period.

HS sections cover broad product categories:

  • Sections 1-5: Animal and vegetable products

  • Sections 6-7: Chemical and plastic products

  • Sections 8-14: Raw materials and manufactured goods

  • Sections 15-16: Base metals and machinery

  • Sections 17-21: Transport, instruments, and miscellaneous

Note: Some country pairs may have sparse trade relationships. Very small values indicate limited trade below typical reporting thresholds.

See Also

africa_cities_ports, africa_network, flownet-package

Examples

Run this code
data(africa_trade)
head(africa_trade)

# Number of trading pairs
length(unique(paste(africa_trade$iso3_o, africa_trade$iso3_d)))

# Total trade by section
aggregate(value ~ section_name, data = africa_trade, FUN = sum)

# Largest bilateral flows
africa_trade[order(-africa_trade$value), ][1:10, ]

# Trade between specific countries
subset(africa_trade, iso3_o == "ZAF" & iso3_d == "NGA")

Run the code above in your browser using DataLab