Skip to contents

The GeoScale class

A nested spatial partition: a flat table of weighted leaf regions (“leaves”) 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_leaf_column()
The leaf column of a GeoScale
geoscale_weights()
Weight columns of a GeoScale
geoscale_add_weight()
Add a weight column to a GeoScale
attach_labels_geoscale() geoscale_labels() geoscale_label()
Labels of regions and geoframes
hide_geoframes_geoscale() show_geoframes_geoscale()
Hide geoframes from plots
geoscale_tree()
The parts of a GeoScale and which of them may change
geoscale_id()
The identity 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 leaves 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_geoleaves() recast_from_geoleaves()
Recast region data down to the leaf layer, and back
recast_pairs()
Recast data keyed by a pair of regions
reexports recast
Objects exported from other packages
geoscale_map()
Crosswalk between two geoframes of a GeoScale
geoscale_map_between()
Crosswalk between two GeoScales through their shared leaves
register_geoscale_map() register_geoscale_map_between() get_geoscale_map() get_geoscale_map_between() 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
geoscale_rule_action()
What a rule does in each direction
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?
geoscale_adjacent()
Adjacency between the features of a geoframe
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
check_geometry_geoscale()
Check that the geometry of a GeoScale is on the right regions

Visualization

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

geom_geoscale() theme_geoscale()
GeoScale layers for ggplot2
gg_geoscale() autoplot(<GeoScale>) plot(<GeoScale>)
Plot 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