
countryatlas: join World Bank data, country codes and maps on the ISO spine
Source:R/countryatlas-package.R
countryatlas-package.Rdcountryatlas exists to kill one recurring source of pain: country names
never line up across data sources. The package makes ISO codes the universal
join key and hands you a ready-to-map tibble that stitches together map
geometry (ggplot2::map_data() or Natural Earth sf), World Bank indicators
(WDI::WDI()) and the countrycode::countrycode() crosswalk.
Details
The happy path stays one call: world_data(). Everything else is opt-in.
Core data assembly
world_data(), country_data(), world_geometry(), locate_country(),
country_borders(), neighbors(), distance_between().
The join engine
standardize_country(), join_world(), attach_geometry(), country_join(),
country_join_all(), dissolve_country().
Reference data
convert_country(), country_codes(), country_groups(), in_group(),
wdi_search(), and the datasets country_meta, common_indicators,
country_groups_tbl, world_snapshot, world_tiles, historical_codes.
Analysis helpers
per_capita(), aggregate_regions(), rank_countries(), complete_years(),
growth_rate(), index_to(), share_of_world(), lag_by_country(),
diff_by_country(), correlate_indicators(), beta_convergence(),
sigma_convergence(), gini(), theil(), morans_i().
Visualization
world_map(), globe_map(), spin_globe(), facet_map(), bubble_map(),
spike_map(), bivariate_map(), cartogram_map(), dorling_map(),
tile_map(), flow_map(), animate_world(), interactive_map(),
geom_country_labels(), theme_world_map(), simplify_geometry().
Options
Three options change the package's behaviour. All are unset by default.
countryatlas.cache_dirWhere the persistent World Bank cache lives. Defaults to
tools::R_user_dir("countryatlas", "cache"); set it to""for session-only caching. Seeclear_wdi_cache().countryatlas.workersHow many processes fetch indicators in parallel (only when the cache is on disk – a memory-only memo cannot survive a fork). Defaults to one fewer than the available cores, and to 2 under
R CMD check, per CRAN policy. Must be a single finite number; values below one are clamped to one.countryatlas.gdp_compatSet to
TRUEto restore thegdp_per_capita_2015column thatworld_data()emitted in 1.0.0. It is a one-cycle deprecation shim and off by default.
Author
Maintainer: Youzhi Yu yuyouzhi666@icloud.com