Every (coarser, finer) code pair that shares at least one atom, for all
level pairs.
Arguments
- x
A
Geoscale.
Details
Computed atom-mediated, directly from @leaves — deliberately not as a
transitive closure of geo_family(). timeslices can use a closure
because time levels genuinely nest; spatial levels cross-cut, and a closure
then manufactures false relationships. In the example Geoscale, zone ZB
straddles both countries, so closing country -> state -> zone -> atom
would wrongly report country N as an ancestor of atom A5, which lies in
country S.
For levels that do not nest this relation is overlap, not containment —
test a given pair with geo_nests().
Level columns are retained because region codes are not unique across
levels: in the example, "N1" exists at both state and zone, so a bare
(parent, child) pair would read as a self-loop.
Examples
head(geo_ancestry(geoscale_example()))
#> parent_level parent child_level child
#> 1 country N atom A1
#> 2 country N atom A2
#> 3 country N atom A3
#> 4 country N atom A4
#> 5 country N state N1
#> 6 country N state N2