Overview
The PPP package uses official economic data from the World Bank to calculate fair, purchasing-power-adjusted prices across different countries. This ensures your pricing reflects real-world economic conditions rather than arbitrary conversions.World Bank Indicator
The package uses the Price Level Ratio of PPP conversion factor (GDP) to market exchange rate indicator.Indicator Code:
PA.NUS.PPPC.RFThis indicator measures the ratio of purchasing power parity (PPP) conversion factor to market exchange rate. It shows how much a basket of goods that costs $1 in the United States would cost in another country.What This Means
The Price Level Ratio tells you the relative cost of living in each country compared to the United States:- ~0.29 (Sri Lanka) → Goods cost approximately 29% of US prices
- 1.0 (United States) → Baseline reference point
- >1.0 (Switzerland ~1.08) → Goods are more expensive than in the US
Data Collection Process
The package maintains up-to-date PPP data through an automated update script located atscripts/update-data.js.
How Data is Sourced
-
Downloads Excel file from the World Bank API:
- Processes the Excel data using the XLSX library to extract country-specific ratios
- Selects the most recent data for each country by iterating through years in reverse order
-
Stores dual country codes in
data.json:- 3-letter ISO codes (e.g.,
LKA) - 2-letter ISO codes (e.g.,
LK)
- 3-letter ISO codes (e.g.,
Data Structure
The processed data is stored indata.json as a simple key-value map:
Update Frequency
The World Bank typically updates PPP indicators annually. The data reflects economic conditions from the previous year.
When to Update
You should update the package data:- Annually - When the World Bank releases new PPP data (usually mid-year)
- After major economic events - Currency crises, significant inflation, or policy changes
- Before major pricing decisions - Ensure you’re working with current data
Running the Update Script
To update the data yourself:- Download the latest Excel file from the World Bank
- Parse and process the data
- Update
data.jsonwith the most recent values - Display a summary of countries processed
Data Coverage
The package currently includes PPP ratios for 200+ countries and territories, covering:- All major economies
- Most developing nations
- Many territories and island nations
- Special administrative regions (Hong Kong, Macau)
Missing Countries
If a country code is not found in the data, theppp() function returns null. This can happen for:
- Very small territories without economic data
- Regions in conflict where data collection is impossible
- Newly formed nations not yet in the World Bank database
Data Quality
The World Bank collects this data through:- International Comparison Program (ICP) - Coordinated global price surveys
- National statistical offices - Official government data
- Regional coordinators - Ensure consistency across countries
The PPP conversion factors are calculated using detailed price data for hundreds of goods and services, weighted by consumption patterns in each country.
Learn More
For detailed information about the World Bank’s methodology:World Bank Indicator Documentation
View official documentation, methodology, and historical data for the PA.NUS.PPPC.RF indicator