Materialises the from -> atoms -> to route as a table: one row per pair of
overlapping units with
scale_map(x, from, to, weight = NULL, by = character(), ...)The NestedScale the frames belong to.
Frame names of x.
Weight column for w. NULL uses the default weight; when
the object declares no weights at all, every atom gets weight 1 (an equal
split).
Extra identifier columns carried through from
scale_atom_pairs() (e.g. "year").
Passed to scale_atom_pairs().
A data.frame with columns <from>, <to> (NA = uncovered by
to), n_from, n_overlap, w, w_from, plus any by columns.
n_from – atoms in the from unit (its full set, before any target
coverage is considered),
n_overlap – atoms the pair shares,
w – the weight of the overlap (summed atom weights, chosen weight
column), the quantity "weighted_mean" aggregation uses,
w_from – the full weight of the from unit; w / w_from is the split
share "sum" disaggregation uses.
The two label columns are named by the frames; rows with an NA target
label are atoms to does not cover. A crosswalk registered with
register_scale_map() is returned as-is instead of being derived.
scale_map_between() for the map between two scales.
s <- scale_example()
scale_map(s, "class", "group")
#> class group n_from n_overlap w w_from
#> 1 G1 G1 2 2 300 300
#> 2 G2 GB 2 2 700 700
#> 3 S1 GB 2 1 500 1100
#> 4 S1 GC 2 1 600 1100
scale_map(s, "sector", "class", weight = "count")
#> sector class n_from n_overlap w w_from
#> 1 P G1 4 2 100 200
#> 2 P G2 4 2 100 200
#> 3 S S1 2 2 100 100