• First release. nestedscales is the dimension-agnostic core under timescales and geoscales: their Calendar and Geoscale classes are subclasses of its NestedScale, so every verb below works on calendars and region hierarchies as well as on any other dimension.

Scales

Conversion

  • recast_scale() converts data between resolutions in either direction with the rules sum, weighted_mean, mean, copy, sd, share and logshare (SCALE_RULES), one per value column if needed. Other columns are kept as identifiers.
  • recast_to_atoms() and recast_from_atoms() are the two halves of the route, and recast between two scales that share atom keys.
  • recast_crosswalk() runs the same engine over a crosswalk built elsewhere, such as timescales’ mapping of one calendar onto another.
  • recast() is the S7 generic that timescales and geoscales extend, so one pipeline can recast time and space in turn.
  • scale_map(x, from, to) returns the crosswalk between two frames of a scale and scale_map_between(from, to) the one between two scales; register_scale_map() / register_scale_map_between() and register_scale_rule() record exact crosswalks and per-column rules. A value column without a rule is an error, never a guess.
  • join_scale() attaches a scale’s labels, coarser frames (attach =), shares and weights to a dataset.
  • Declared residuals (scale_from_leaftable(residuals = ), scale_residuals()) aggregate upward but never receive a share when a coarse value is split. reconcile_scale() compares aggregated data with an independent total and can balance the gap.

Data backends and large data

  • Every verb accepts a data.frame, tibble, data.table, dtplyr table or arrow table/dataset, and returns the same class. Lazy inputs return a query unless collect = TRUE.
  • A target whose sources are only partly present comes back NA; missing_sources = "ignore" aggregates whatever is there instead.
  • diagnostics = controls the checks that scan the data (off by default for lazy inputs); batch = and batch_by = process a job in chunks of identifier values.

Products of scales

Clustering

Arrays and storage

Building a dimension package

  • vignette("nestedscales") introduces the representation and the main functions; the package website includes a roadmap of what the package offers and what is planned.
  • A dimension package defines a NestedScale subclass, as timescales and geoscales do. scale_alias_property() gives an inherited property the dimension’s own name; scale_vocab() puts the dimension’s words in error messages; scale_payload_slice() keeps per-atom data (such as geometry) in step when rows are subset; scale_atom_pairs() lets a dimension generate its atom layer.
  • .ms_backend() and the other .ms_* helpers provide the backend handling to packages built on nestedscales.