Skip to contents

Materialises the from -> leaves -> to route as a table: one row per pair of overlapping regions with

Usage

geoscale_map(
  gs,
  source,
  target,
  weight = NULL,
  from = lifecycle::deprecated(),
  to = lifecycle::deprecated()
)

Arguments

gs

The GeoScale the geoframes belong to.

source, target

Geoframe names of gs.

weight

Weight column for w. NULL uses the default weight; when the object declares no weights at all, every leaf gets weight 1 (an equal split).

from, to

Deprecated names of source and target.

Value

A data.frame with columns <source>, <target> (NA = uncovered by target), n_from, n_overlap, w, w_from.

Details

  • n_from – leaves in the source region (its full set, before any target coverage is considered),

  • n_overlap – leaves the pair shares,

  • w – the weight of the overlap (summed leaf weights, chosen weight column), the quantity "weighted_mean" aggregation uses,

  • w_from – the full weight of the source region; w / w_from is the split share "sum" disaggregation uses.

The two label columns are named by the geoframes; rows with an NA target label are leaves target does not cover. A crosswalk registered with register_geoscale_map() is returned as-is instead of being derived.

See also

geoscale_map_between() for the map between two GeoScales.

Examples

gs <- geoscale_example()
geoscale_map(gs, "state", "zone")
#>   state zone n_from n_overlap   w w_from
#> 1    N1   N1      2         2 300    300
#> 2    N2   ZB      2         2 700    700
#> 3    S1   ZB      2         1 500   1100
#> 4    S1   ZC      2         1 600   1100
geoscale_map(gs, "country", "state", weight = "km2")
#>   country state n_from n_overlap    w w_from
#> 1       N    N1      4         2  300   1000
#> 2       N    N2      4         2  700   1000
#> 3       S    S1      2         2 1100   1100