Skip to contents

geoscale_children() and geoscale_parents() step one geoframe; geoscale_descendants() and geoscale_ancestors() follow the transitive closure.

Usage

geoscale_children(
  x,
  geoframe,
  region,
  target = NULL,
  to = lifecycle::deprecated()
)

geoscale_parents(
  x,
  geoframe,
  region,
  target = NULL,
  to = lifecycle::deprecated()
)

geoscale_descendants(
  x,
  geoframe,
  region,
  target = NULL,
  to = lifecycle::deprecated()
)

geoscale_ancestors(
  x,
  geoframe,
  region,
  target = NULL,
  to = lifecycle::deprecated()
)

Arguments

x

A GeoScale.

geoframe

Geoframe that region belongs to.

region

Character vector of region codes at geoframe.

target

Target geoframe. For geoscale_children() and geoscale_parents() this defaults to the adjacent geoframe; for the transitive versions, NULL means all geoframes below/above.

to

Deprecated name of target.

Value

geoscale_children() and geoscale_parents() return a character vector of codes at a single geoframe. geoscale_descendants() and geoscale_ancestors() span several geoframes and so return a data.frame with columns geoframe and region — a bare character vector would be ambiguous, since the same code can occur at more than one geoframe.

Details

geoframe is required in every case — region codes are not unique across geoframes, so a bare code is ambiguous.

Examples

gs <- geoscale_example()
geoscale_children(gs, "country", "N")
#> [1] "N1" "N2"
geoscale_parents(gs, "state", "N1", target = "country")
#> [1] "N"
geoscale_descendants(gs, "country", "N")
#>   geoframe region
#> 1    state     N1
#> 2    state     N2
#> 3     zone     N1
#> 4     zone     ZB
#> 5     cell     A1
#> 6     cell     A2
#> 7     cell     A3
#> 8     cell     A4
geoscale_ancestors(gs, "cell", "A5")
#>   geoframe region
#> 1  country      S
#> 2    state     S1
#> 3     zone     ZB