countryatlas 2.0.0
A major release that wires countryatlas into the database-rendering world via ‘ggsql’, widens the map vocabulary, and fixes several correctness issues found by auditing 1.0.0. The version is bumped to 2.0.0 because the bug fixes change the output of world_map() (quantile binning), bubble_map() / flow_map() (de-duplicated symbols), geom_country_labels() (label placement) and convert_country() (override-only entities) — code that depended on the old behaviour may see different maps or values.
New: database-side rendering with ggsql
-
as_ggsql_source()exports a curated, ISO-reconciled, WDI-joined table (withsfgeometry WKB-encoded) as a ggsql source — a DuckDB connection, a Parquet file, or a nanoarrow stream. countryatlas does the reconciliation ggsql’s static bundled world can’t; ggsql does the database push-down and Vega-Lite output countryatlas doesn’t. -
world_query()emits aggsqlspatial query (VISUALISE … DRAW spatial PROJECT TO … SCALE … LABEL …) — a dependency-free string builder. -
interactive_map(engine = "ggsql")registers the data and renders the map in DuckDB, returning a Vega-Lite widget. -
ggsql,duckdb,DBIandnanoarroware optionalSuggests. See the new countryatlas and ggsql vignette.
New: maps, projections and helpers
-
globe_map()— an orthographic globe choropleth, withbackend = "sf"(smoothest limb) orbackend = "polygon"(needs onlymaps+mapproj). -
spin_globe()— a rotating-globe animated GIF (oneglobe_map()frame per central longitude, assembled withgifskiormagick). -
facet_map()— small-multiple choropleths (the static counterpart toanimate_world()). -
wdj_crs()gains eight projections (mercator,winkel_tripel,eckert4,gall_peters,orthographic,azimuthal_equal_area,north_polar,south_polar);world_map()/world_geometry()accept them all. -
locate_country()— point-in-polygon lookup tagginglon/latwithiso3c. -
repair_country_names()— the “act on it” companion tocheck_country_match(): auto-applies confident string-distance fixes. -
country_join_all()— reduce-join many messy country tables on the ISO spine. -
growth_rate(),index_to(),share_of_world()— panel analysis helpers. -
country_overrides()— preferred name forwdj_overrides()(kept as an alias) after the rename to countryatlas. -
country_groups_tblgainsMercosur,GCC,NordicandVisegrad.
Bug fixes
-
world_map(style = "quantile"/"jenks")computed breaks over polygon vertices, so a country’s geometric complexity biased the quantiles and the bins held unequal numbers of countries. Breaks are now computed on one value per country. -
bubble_map(backend = "sf")placed bubbles in projected metres on a degrees base map (off the map). The base map and bubbles now share one projected CRS viacoord_sf(). - Polygon centroids returned more than one row for ten
iso3ccodes (overrides map several names — Azores/Madeira → PRT — to one code), fanning out joins inbubble_map()/flow_map(). Centroids are now one antimeridian-safe row per country (the largest piece). -
geom_country_labels()placed labels at the bounding-box midpoint over all of a country’s pieces, so the US / Fiji / NZ labels drifted into the wrong ocean. Labels now sit on each country’s largest piece. -
projection = "plate_carree"built an incoherent PROJ string (+proj=longlat … +units=m); it is now true equirectangular (+proj=eqc). -
convert_country()only appliedwdj_overrides()forto = "iso3c", so override-only entities (e.g. “Canary Islands”) returnedNAfor derived destinations. It now routes through the correctediso3cfirst.
countryatlas 1.0.0
CRAN release: 2026-06-24
A single, comprehensive release that takes the package from a one-function proof of concept to a complete toolkit for joining world data to maps. The spirit is unchanged — ISO codes as the universal join key, one call to a map-ready table — but pushed to its full potential.
Breaking-ish changes
-
world_data()is generalised but backward-compatible:world_data(2020)still returns the classic polygon-backed, GDP-per-capita tibble. The only visible change is the column namegdp_per_capita_2015→gdp_per_capita. A one-cycle deprecation shim keepsgdp_per_capita_2015available as an alias (toggle withoptions(countryatlas.gdp_compat = FALSE)). - The 16 regions the previous version silently dropped (Kosovo, Micronesia, the Virgin Islands, Saint Martin, Bonaire/Saba/Sint Eustatius, the Canary Islands, Madeira/Azores, …) are now matched via [
wdj_overrides()] instead of deleted, so they appear on maps. Diffs of map output will show increased coverage.
New: core data assembly
-
world_data()gainsindicator(one or many WDI codes; named vectors drive clean column names), multi-year panels, ansfbackend (geometry = "sf"),regionsubsetting,latest, projections and caching. -
country_data()— the lightweight, one-row-per-country analysis table. -
world_geometry()— projected, region-subset geometry (countries, centroids, coastline, borders, graticule, ocean).
New: diagnostics
-
check_country_match(),wdj_overrides(),audit_coverage()— never lose a country silently.
New: reference data & translation
-
convert_country()(flags, currency, tld, research codes),country_codes(),country_groups()/in_group(),wdi_search(). - Bundled datasets:
world_snapshot,country_meta,common_indicators,country_groups_tbl,world_tiles.
New: visualization
-
world_map()(continuous / binned / quantile / jenks / categorical),bubble_map(),bivariate_map(),cartogram_map(),tile_map(),flow_map(),animate_world(),interactive_map(),geom_country_labels(),theme_world_map().
Performance & offline
- WDI fetches are memoised with an optional on-disk cache; multiple indicators are fetched in parallel (
parallel::mclapply) where supported. Seeclear_wdi_cache(). - The bundled
world_snapshotlets every example, test and vignette run offline and deterministically.
Engineering
- Namespace hygiene (targeted
@importFrominstead of blanket@import). - Input validation with friendly
cli/rlangerrors. - A
testthat(3e) suite; network calls are skipped offline and on CRAN. - Vignettes and a
pkgdownsite. - Refreshed CI: R-CMD-check, test-coverage and pkgdown workflows.
- Heavy spatial dependencies (
sf,rnaturalearth,cartogram,biscale,geofacet,gganimate,leaflet, …) are all inSuggestsand gated byrlang::check_installed(), so the base install stays light.
Group memberships in country_groups_tbl are point-in-time as of 2024-01-01.
