Skip to contents

geoscales 0.1.0.9000

Milestone 1

First working version: the Geoscale class, the conversion verb, navigation, plotting, and the Natural Earth provider.

Core

  • Geoscale, an S7 class holding leaves (one row per atom, one column per level), levels (ordered coarsest first), members (code vocabulary per level), optional geometry, and meta. Everything derivable is computed on demand; nothing is cached on the object.
  • Three construction layers: geoscale_from_leaves() (escape hatch), geoscale_build() (from parent-child crosswalks — ragged, not Cartesian, because ragged hierarchies are the norm in space), and geoscale_from_provider().
  • geoscale_example(), a synthetic fixture reproducing three awkward features of real region tables: a code reused at several levels, a cross-cutting level pair, and an atom with no code at any coarser level.

Conversion

  • geo_recast() — aggregation and disaggregation as a single operation. Source values are projected down to atoms and then aggregated up to the target, so direction falls out of the level ranks and cross-cutting levels work without special handling.
  • Rules sum, weighted_mean, mean and copy, each defined in both directions.
  • geo_register_rule() / geo_get_rule() / geo_list_rules() — a per-parameter rule registry, with an explicit rule= always taking precedence.
  • na_action = "drop" | "error" | "keep" for partial coverage. "drop" genuinely loses the uncovered share and warns with a count; "keep" conserves totals into an explicit NA group.
  • Identifier columns are preserved as grouping columns, so panel data converts in one call.

Geometry and plotting

Providers

  • geo_register_provider() / geo_provider() / geo_list_providers().
  • Natural Earth via ne_source() and ne_geoscale(), with source and scale recorded in meta. The package ships no maps and selects no boundaries.
  • Three Natural Earth pitfalls are handled: adm0_a3 is used as the join key (iso_a3 is -99 for five countries at 1:110m); area weights are refused at scale 110 with a warning; and -99 is converted to NA in numeric attributes as well as code columns.