Skip to contents

The Geoscale class

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

Geoscale()
Geoscale (S7 class)
geoscale_example()
A small example Geoscale
geoscale_geoframes() names(<Geoscale>)
Geoframes of a Geoscale
geoscale_regions()
Regions present at a geoframe (the members)
geoscale_rank()
Geoframe rank
geoscale_weights()
Weight columns of a Geoscale
summary(<Geoscale>) summary(<geoscales::Geoscale>) print(<summary_Geoscale>)
Summarize 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_leaftable()
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 geoframe ranks and cross-cutting geoframes need no special handling.

recast_geoscale()
Recast values from one spatial resolution to another
recast_to_geoatoms() recast_from_geoatoms()
Recast region data down to the atom layer, and back
reexports recast
Objects exported from other packages
geoscale_map()
Crosswalk between two spatial resolutions through the atom layer
register_geoscale_map() get_geoscale_map() list_geoscale_maps()
Register / look up a direct spatial crosswalk
clear_geoscale_maps()
Clear the registered spatial crosswalks
join_geoscale()
Attach a Geoscale to region-keyed data
GEOSCALE_RULES
Supported aggregation rules
register_geoscale_rule()
Register how a parameter should be recast
get_geoscale_rule()
Look up a registered rule
list_geoscale_rules()
List registered rules
clear_geoscale_rules()
Clear the rule registry

Region codes are not unique across geoframes, so every lookup names its geoframe.

geoscale_children() geoscale_parents() geoscale_descendants() geoscale_ancestors()
Navigate a region hierarchy
geoscale_leaftable() as.data.frame(<Geoscale>) as.data.frame(<geoscales::Geoscale>) fortify(<Geoscale>)
The leaftable of a Geoscale
geoscale_family()
Immediate parent-child table between two geoframes
geoscale_ancestry()
Ancestry between all geoframe pairs
geoscale_nests()
Do two geoframes nest?
filter_geoscale()
Subset a Geoscale by region
geoscale_coverage()
Sampled coverage of a Geoscale
prune_geoscale()
Collapse a Geoscale to a coarser geoframe
zoom_geoscale()
Telescoping zoom: fine detail in a focus area, coarse elsewhere
geoscale_share()
Weight shares within a geoframe

Geometry

Optional, and backed by ‘sf’. The core is geometry-free.

attach_geometry_geoscale()
Attach geometry to a Geoscale
geoscale_geometry()
Geometry dissolved to a geoframe
coords_to_region()
Map coordinates to the regions that contain them
add_area_geoscale()
Compute area weights from attached geometry

Visualization

Composable choropleth layers, the structure icicle, and their plain-data workers. geoscale_autoplot() needs no map.

geom_geoscale() theme_geoscale()
Geoscale layers for ggplot2
geoscale_autoplot() autoplot(<Geoscale>)
Plot a Geoscale
plot(<Geoscale>) plot(<geoscales::Geoscale>)
Plot a Geoscale
geoscale_plot()
Map data onto a Geoscale
geoscale_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.

get_geoscale_provider()
Look up a registered provider
register_geoscale_provider()
Register a Geoscale data provider
list_geoscale_providers()
List registered providers
ne_source()
Fetch a Natural Earth source table
ne_geoscale()
Build a Geoscale from Natural Earth

Geoframes

CORE_GEOFRAMES
Core spatial geoframes
is_valid_geoframe()
Validate geoframe names

Package

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