Skip to contents

The Geoscale class

A nested spatial partition: a flat table of weighted leaf regions (“atoms”) plus the ordered levels that group them.

Geoscale()
Geoscale (S7 class)
geoscale_example()
A small example Geoscale
geo_levels()
Levels of a Geoscale
geo_regions()
Regions present at a level
geo_rank()
Level rank
geo_weights()
Weight columns of a Geoscale
`[`(<Geoscale>) `[`(<geoscales::Geoscale>)
Subset a Geoscale with [

Construction

Three layers, from most to least convenient: a provider, parent-child crosswalks, or a wide table you already have.

geoscale_from_provider()
Build a Geoscale from a provider
geoscale_build()
Build a Geoscale from parent-child crosswalks
geoscale_from_leaves()
Build a Geoscale from a flat table of leaf regions

Conversion

Aggregation and disaggregation are one operation. Values are projected down to atoms and aggregated up to the target, so direction follows the level ranks and cross-cutting levels need no special handling.

geo_recast()
Recast values from one spatial level to another
GEO_RULES
Supported aggregation rules
geo_register_rule()
Register how a parameter should be recast
geo_get_rule()
Look up a registered rule
geo_list_rules()
List registered rules
geo_clear_rules()
Clear the rule registry

Region codes are not unique across levels, so every lookup names its level.

geo_children() geo_parents() geo_descendants() geo_ancestors()
Navigate a region hierarchy
geo_family()
Immediate parent-child table between two levels
geo_ancestry()
Ancestry between all level pairs
geo_nests()
Do two levels nest?
geo_filter()
Subset a Geoscale by region
geo_prune()
Collapse a Geoscale to a coarser level
geo_share()
Weight shares within a level

Geometry and plotting

Optional, and backed by ‘sf’. The core is geometry-free; geo_autoplot() draws the hierarchy itself and needs no map.

geo_attach_geometry()
Attach geometry to a Geoscale
geo_geometry()
Geometry dissolved to a level
geo_area()
Compute area weights from attached geometry
geo_autoplot() autoplot.Geoscale()
Plot a Geoscale
geo_plot()
Map data onto a Geoscale
geo_layout()
Icicle layout for a Geoscale

Data providers

geoscales ships integration code, not data. Natural Earth is the default provider; its source and scale are recorded on the object, and no boundaries are bundled.

geo_provider()
Look up a registered provider
geo_register_provider()
Register a Geoscale data provider
geo_list_providers()
List registered providers
ne_source()
Fetch a Natural Earth source table
ne_geoscale()
Build a Geoscale from Natural Earth

Levels

CORE_LEVELS
Core spatial levels
is_valid_level()
Validate level names

Package

geoscales geoscales-package
geoscales: Nested Regions and Spatial Hierarchies for Modeling