A nested discrete partition: a flat table of atoms plus the ordered hierarchy of frames that groups them. The dimension is not named – time and space are the subclasses Calendar (timescales) and Geoscale (geoscales); anything else (industries, income brackets, temperature regimes, technology vintages) is declared directly.

NestedScale(
  leaftable,
  frames,
  members,
  key = "unit",
  meta = list(),
  attributes = NULL,
  aliases = NULL
)

Arguments

leaftable

data.frame with a unique key column, one column per frame in frames, and zero or more numeric weight columns.

frames

Ordered character vector of frame names (coarsest first); each must appear as a column of leaftable.

members

Named list; members[[f]] is the full ordered set of codes present at frame f. Must equal the non-NA values of leaftable[[f]] as a set.

key

Name of the atom key column (a single string, default "unit").

meta

Named list of attributes (name, desc, weights, default_weight, residuals (see scale_residuals()), labels, source, sample bookkeeping).

attributes

Optional table of per-member physical attributes keyed by (frame, unit); see attach_attributes_scale() for the columns.

aliases

Optional table of alternative labels keyed by (frame, unit); see attach_aliases_scale() for the columns.

Value

A NestedScale object.

Details

Construct with scale_from_leaftable().

Examples

scale_example()
#> NestedScale: example
#> Description: Synthetic example: reused code, non-nesting frame pair, and an unassigned atom 
#> Frames (4, coarsest first):
#>   - sector (2)  [1 unit unassigned]
#>     - class (3)  [1 unit unassigned]
#>       - group (3)  [1 unit unassigned]
#>         - unit (7)
#> Atoms: 7
#> Weights: size, count (default: size)