Package: countryatlas 4.0.0

countryatlas: Join World Bank Data, Country Codes and Maps on the ISO Spine

A complete toolkit for getting country data onto honest maps. Country names rarely line up across data sources ("US", "U.S.", "United States", "United States of America" are one country, but a naive join treats them as four), so 'countryatlas' makes ISO codes the universal join key, and matches names in many languages. It joins indicators from the World Bank, Our World in Data, the European Union's statistical office and any statistical data and metadata exchange service to bundled Natural Earth borders and the 'countrycode' Rosetta stone, recording each value's source, unit and release, and can pin a World Bank release so a result reproduces; treats country-year panels as first class, with dated income groups, regions and group memberships, lags keyed on the year and aggregates that report their coverage; adds analysis helpers (per-capita, inequality, convergence, distribution dynamics, rates, and spatial statistics with multiple-testing control); and draws a full vocabulary of equal-area maps (classed and continuous choropleths, proportional-symbol, spike, bivariate, ternary, value-by-alpha, cartogram, tile-grid, flow, small-multiple, animated, globe and interactive), and can hand its curated tables to 'ggsql' for database-side rendering. Honesty is treated as a feature rather than a slogan: maps state their coverage and source, draw small states rather than dropping them and describe themselves in alt text, classification methods can be compared side by side, and the distortion each projection introduces can be measured and drawn. Heavy spatial dependencies stay optional, and a bundled offline snapshot lets every example, test and vignette run without the network.

Authors:Youzhi Yu [aut, cre]

countryatlas_4.0.0.tar.gz
countryatlas_4.0.0.zip(r-4.7-any)countryatlas_4.0.0.zip(r-4.6-any)countryatlas_4.0.0.zip(r-4.5-any)
countryatlas_4.0.0.tgz(r-4.6-any)countryatlas_4.0.0.tgz(r-4.5-any)
countryatlas_4.0.0.tar.gz(r-4.7-any)countryatlas_4.0.0.tar.gz(r-4.6-any)
countryatlas_4.0.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
countryatlas/json (API)

# Install 'countryatlas' in R:
install.packages('countryatlas', repos = c('https://pursuitofdatascience.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/pursuitofdatascience/countryatlas/issues

Pkgdown/docs site:https://pursuitofdatascience.github.io

Datasets:

On CRAN:

Conda:

countrycodesdatavizeconomics-dataggplot2worldbankworlddataworldmap

6.17 score 3 stars 10 scripts 399 downloads 124 exports 36 dependencies

Last updated from:ae13a0232c. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-develOK200
source / vignettesOK304
linux-releaseOK272
macos-releaseOK255
macos-oldrelOK177
windows-develOK201
windows-releaseOK225
windows-oldrelOK219
wasm-releaseOK150

Exports:add_indicatoraggregate_groupsaggregate_regionsanimate_worldas_ggsql_sourceattach_geometryaudit_coverageaudit_time_coveragebeta_convergencebivariate_lisabivariate_mapbubble_mapcartogram_diagnosticscartogram_mapcheck_country_matchcheck_dispute_coveragecheck_paletteclassify_compareclassify_countriesclear_country_cacheclear_wdi_cachecompare_sourcescompare_vintagescomplete_yearsconvergence_clubconvert_countrycorrelate_indicatorscountry_borderscountry_codescountry_datacountry_factsheetcountry_groupscountry_joincountry_join_allcountry_networkcountry_overridescountry_sourcescountry_timelinecountry_weightscoverage_mapdeflatediff_by_countrydispute_policydissolve_countrydistance_betweendorling_mapeb_morans_ifacet_mapfetch_comtradefetch_eurostatfetch_indicatorfetch_oecdfetch_owidfetch_sdmxflow_mapflow_matrixgearys_cgeom_country_labelsgetis_ordginiglobe_mapgridded_cartogramgrowth_ratehistorical_geometryin_groupindex_toinequalityinteractive_mapinterpolate_missingjoin_countsjoin_worldlag_by_countrylisa_maplocal_moranslocate_countrymap_alt_textmap_citationmap_provenancemorans_ineighborsnuts_geometryod_mapper_capitaproject_lonlatprojection_compareprojection_distortionprojection_inforank_countriesrank_mobilityrate_checkrate_funnelregister_country_sourceremove_country_sourcerepair_country_namesshare_of_worldsigma_convergencesimplify_geometrysmooth_ratessource_infosource_info<-spatial_lagspatial_markovspike_mapspin_globestandardize_countrystandardize_subnationalsubnational_mapternary_maptheiltheme_world_maptile_maptile_trend_maptissot_mapto_ppptransition_matrixvalue_by_alpha_mapwdi_searchwdi_vintagesworld_dataworld_geometryworld_mapworld_queryworld_tablezoom_map

Dependencies:cachemclicountrycodecpp11curldplyrfarverfastmapgenericsggplot2gluegtableisobandjsonlitelabelinglifecyclemagrittrmemoisepillarpkgconfigpurrrR6RColorBrewerrlangS7scalesstringistringrtibbletidyrtidyselectutf8vctrsviridisLiteWDIwithr

Beyond the choropleth
Proportional-symbol (bubble) maps | Spike maps | Equal-area tile grids | Flow maps | Small multiples | Labels | Maps that need optional packages | Value-by-alpha: the cartogram's non-distorting cousin | Country adjacency and distance

Last update: 2026-10-02
Started: 2026-06-18

countryatlas: Joining World Data to Maps on the ISO Spine
Abstract | Introduction | Core data assembly | world_data() | country_data() and attach_geometry() | Visualising: the choropleth and beyond | One-line choropleths | Proportional-symbol maps | Equal-area tile grids | Flow maps | The join engine | Diagnostics: never lose a country silently | Reference data and code translation | Analysis helpers | Inequality, correlation and convergence | Performance and offline use | Conclusion | Session information

Last update: 2026-10-02
Started: 2026-06-18

Data you can trace: sources, vintages and provenance
Every column knows its source | Fetching with the record attached | Pinning a release | Your own source, on the same footing | Two sources, one indicator | What the record holds

Last update: 2026-10-02
Started: 2026-10-02

Getting started
A map-ready tibble in one call | Your first choropleth | Choosing indicators | Next steps

Last update: 2026-10-02
Started: 2026-06-18

Honest maps: classification, missingness and distortion
1. The classification is doing the talking | 2. Grey is not a value | 3. Small denominators shout | 4. The projection is doing the talking too | 5. Say what the map is | 6. Where the data comes from, and when | 7. Islands are not missing at random | References

Last update: 2026-10-02
Started: 2026-09-03

Joining your own data
Standardise any frame | One call to a map | Reconcile two messy tables | Reconcile many tables at once | Check before you trust | Historical data: dissolved countries | Repair what can be repaired | Custom origins | Point data onto the spine

Last update: 2026-10-02
Started: 2026-06-18

Modern maps with sf & projections
An equal-area, projected choropleth | The world as a globe | Just the canvas | Recentring and the antimeridian | Region subsetting | Simplifying for the web

Last update: 2026-10-02
Started: 2026-06-18

Panels done right
A small panel | Joining two panels | Membership as of each row | Classifications as they were | The region that moved | Lags keyed on the year | Aggregates that know what they are missing

Last update: 2026-10-02
Started: 2026-10-02

countryatlas and ggsql
Emit a query (no dependencies) | Render in the database | In a Quarto / R Markdown document | Why bother?

Last update: 2026-09-27
Started: 2026-06-23

Readme and manuals

Help Manual

Help pageTopics
Fetch an indicator and join it to your dataadd_indicator
Aggregate by dated group membershipaggregate_groups
Roll countries up to region / income / continentaggregate_regions
Animate a choropleth over timeanimate_world
Export a countryatlas table as a ggsql sourceas_ggsql_source
Attach geometry to a country-level tableattach_geometry
Coverage / missingness auditaudit_coverage
Does the data respect when countries existed?audit_time_coverage
Beta convergence (growth regression)beta_convergence
Bivariate local Moran: high X among high Ybivariate_lisa
Two-variable bivariate choroplethbivariate_map
Proportional-symbol (bubble) mapbubble_map
Did the cartogram actually converge?cartogram_diagnostics
Area-honest cartogramcartogram_map
Pre-flight country-match reportcheck_country_match
Which disputed territories does your data touch?check_dispute_coverage
Check a map's colours under colour-vision deficiencycheck_palette
The same map under several classificationsclassify_compare
Classify countries as they were classified at the timeclassify_countries
Clear the cached downloadsclear_country_cache
Curated indicator cataloguecommon_indicators
Do two sources agree?compare_sources
How much did a World Bank series change between releases?compare_vintages
Fill or interpolate panel gapscomplete_years
Convergence clubsconvergence_club
Friendly country-code conversionconvert_country
Pairwise correlation of indicators on the spinecorrelate_indicators
Country adjacency (shared land borders)country_borders
Dated World Bank classificationscountry_classifications
The countrycode codelist as a tidy tibblecountry_codes
Lightweight one-row-per-country tablecountry_data
Everything the package knows about one countrycountry_factsheet
Country-group membershipcountry_groups
Dated country-group membershipcountry_groups_history
Country-group membership (point-in-time)country_groups_tbl
Reconcile and join two messy country tablescountry_join
Join many messy country tables on the ISO spinecountry_join_all
Static per-country metadatacountry_meta
Describe an origin-destination table as a networkcountry_network
Curated country-name overrides (replaces the silent drop-list)country_overrides
The registered data sourcescountry_sources
A country's existence span, predecessors and successorscountry_timeline
Spatial weights on the country spinecountry_weights
Map the data availability itselfcoverage_map
Convert a money series to constant pricesdeflate
State which map convention you are usingdispute_policy
Disputed territoriesdisputed_territories
Resolve dissolved entities to their successor statesdissolve_country
Great-circle distance between two countriesdistance_between
Dorling cartogram (first-class verb)dorling_map
Moran's I for rates, not fooled by small denominatorseb_morans_i
Small-multiple choroplethsfacet_map
Fetch an indicator from any registered sourcefetch_indicator
Read any SDMX statistics servicefetch_sdmx
Great-circle origin-destination flow mapflow_map
An origin-destination table as a matrixflow_matrix
Geary's C (spatial autocorrelation)gearys_c
Centroid-anchored country labelsgeom_country_labels
Getis-Ord G statistics (hot spots)getis_ord
Gini coefficient (population-weightable)gini
Orthographic globe choroplethglobe_map
One square per N peoplegridded_cartogram
Year-on-year (or compound) growth rategrowth_rate
Historical / dissolved entities and their successor stateshistorical_codes
Historical country boundarieshistorical_geometry
Is a country in a group?in_group
Rebase a series to an index (base year = 100)index_to
Inequality, every standard measure at onceinequality
Web-ready interactive choroplethinteractive_map
Fill missing values, and say that you didinterpolate_missing
Join counts: do neighbours share a category?join_counts
One call: your data, on a mapjoin_world
Panel lag / difference by countrydiff_by_country lag_by_country
Map LISA clusterslisa_map
Local Moran's I (LISA)local_morans
Tag coordinates with the country that contains themlocate_country
Describe a map in words, for alt textmap_alt_text
Cite exactly what a map usedmap_citation
What went into this mapmap_provenance
Global Moran's I (spatial autocorrelation)morans_i
A country's neighboursneighbors
NUTS geometry for Europenuts_geometry
Origin-destination small multiplesod_map
Normalise an indicator by populationper_capita
Project longitude and latitude onto a countryatlas mapproject_lonlat
The same map under several projectionsprojection_compare
Measure what a projection distortsprojection_distortion
What a projection preservesprojection_info
Add rank, percentile and z-scorerank_countries
How much did the ranking change?rank_mobility
Flag rates computed over tiny denominatorsrate_check
A funnel plot for ratesrate_funnel
Register a data source on the country spineregister_country_source
Remove a registered data sourceremove_country_source
Auto-repair country names to their closest known matchrepair_country_names
Each country's share of the world totalshare_of_world
Sigma convergence (dispersion over time)sigma_convergence
Simplify (thin) geometry for faster plottingsimplify_geometry
Shrink unreliable rates toward the global ratesmooth_rates
Built-in source adaptersfetch_comtrade fetch_eurostat fetch_oecd fetch_owid source_adapters
Where the numbers came fromsource_info source_info<-
The neighbour average, as a columnspatial_lag
Markov transitions conditioned on the neighboursspatial_markov
Spike map (heights at country centroids)spike_map
Spin the globespin_globe
Add ISO codes and classifications to any data framestandardize_country
Standardise subnational region names to ISO 3166-2standardize_subnational
Map subnational datasubnational_map
Ternary choropleth for three-part compositionsternary_map
Theil index, with between/within decompositiontheil
A clean theme for world mapstheme_world_map
Equal-area world tile gridtile_map
A small line chart for every country, on the tile gridtile_trend_map
Tissot's indicatrix: what a projection does to the groundtissot_map
Convert to purchasing-power-parity termsto_ppp
Markov transitions between income classestransition_matrix
Value-by-alpha: equalise a rate by its denominatorvalue_by_alpha_map
Search World Bank indicatorswdi_search
The World Development Indicators releases the archive holdswdi_vintages
Map-ready, enriched country tibbleworld_data
Geometry without the dataworld_geometry
One-line choropleth, several honest stylesworld_map
Emit a ggsql spatial query for a country mapworld_query
Offline snapshot of world dataworld_snapshot
A publication-ready table from a map-ready frameworld_table
Equal-area world tile-grid layoutworld_tiles
Zoom a map without losing its projectionzoom_map