geoscales 0.8.0
Breaking changes
- Requires nestedscales 0.3.0 and follows its vocabulary, with no deprecated aliases: a leaf is a region of the finest layer and one row of the leaftable (was “atom”), and the leaf column is the leaftable column that identifies the leaves (was “key”). A member of a geoframe stays a region.
key=now only names the column of a data table that holds the codes, and “unit” only a unit of measure. - Renamed functions:
recast_to_geoatoms()torecast_to_geoleaves(),recast_from_geoatoms()torecast_from_geoleaves(),geoscale_key()togeoscale_leaf_column(). Renamed argument:keytoleafinGeoScale()andgeoscale_from_leaftable(). The propertyGeoScale@keyis@leaf,summary()returnsn_leaves(wasn_atoms),geoscale_tree()lists the partleafwith the kindleaf column, and printed output and messages say “Leaves” and “leaf”. - The finest geoframe of
geoscale_example()iscell(wasatom), which changes itsgeoscale_id(). The codesA1toA6andROWare unchanged. -
geoscale_labels()returns the columnsgeoframe,region,variant,label(wereframe,unit, …), the namesattach_labels_geoscale()takes. A label table given with aunitcolumn is no longer accepted;frameandmemberare. - The leaftable has no
regioncolumn any more. The leaf column is the finest geoframe’s own column, or the column named byleaf=when the leaves are finer than the finest geoframe;geoscale_leaf_column()returns its name. The leaf column in the result ofrecast_to_geoleaves()carries that name, andrecast_from_geoleaves()expects it.regionis no longer a reserved name and may be used for a geoframe at any depth. Objects saved with aregionleaf column must be rebuilt; objects saved while the leaf column was the propertykeyare still read. -
geoscale_from_leaftable()no longer falls back to aregioncolumn for the leaf column: when the finest geoframe does not identify the leaves,leaf=must be given. -
meta$labels(the name of one per-leaf leaftable column) is replaced by the label table below.labels=ingeoscale_from_leaftable()now takes that table. - The first argument of
recast_geoscale(),recast_to_geoleaves(),recast_from_geoleaves(),recast_pairs()andjoin_geoscale()isdata(wasx). -
weight=always names a weight of the GeoScale. The data column to weight by inrecast_from_geoleaves()andrecast_pairs()isdata_weight=.
New features
- Labels per geoframe.
attach_labels_geoscale()adds display names for regions of any geoframe, in named variants, so a region may have alternative names while another geoframe has none; a row withregion = NAnames the geoframe itself.geoscale_labels()returns the table andgeoscale_label()looks names up, giving the code where there is no label. Subsets, prunes and zooms keep the labels of what remains, and the plots use the default variant. -
geoscale_id()gives the identity of a GeoScale: its name and a hash of its structure. -
check_geometry_geoscale()checks that each shape of the geometry is on the row of its code. Against a referencesfthat carries the codes it compares shape by shape and names the code a misplaced shape belongs to; without one it reports empty or repeated shapes, an area weight held in another row order, and grouped regions in several pieces. - Geoframes hidden from plots.
hide_geoframes_geoscale()marks geoframes that exist for calculation only, andgg_geoscale(),autoplot()andplot()leave them out;show_geoframes_geoscale()reverses it andgeoscale_geoframes(visible = )lists either set. Recasts, joins and navigation are unaffected.gg_geoscale(geoframes = )chooses the geoframes of one figure, hidden or not. -
geoscale_tree()lists the parts of a GeoScale as a tree and marks each onefixed(it enters the identity),derivedormutable, naming the function that changes it;str()prints the same tree. -
gg_geoscale(data = )on the icicle and the stack takes data keyed by any geoframe, named bykey=or found from the columns. The value is recast up from that geoframe to every coarser one it nests in; finer geoframes are outlined without a fill. -
gg_geoscale(type = "stack")fills a single-region geoframe above the colouring geoframe (a nation over its zones) with the next colour of the same palette; it was neutral grey.
Bug fixes
-
geom_geoscale()drawn at a coarser geoframe than the data’s codes filled every region withNA; the codes are now carried up to the drawn geoframe beforefunis applied. The code column defaults to thegeoframe-named column, then the leaf column, thenregion. -
attach_geometry_geoscale(),add_area_geoscale(),ne_geoscale()andgeoscale_from_provider()rebuilt the object from its core parts and dropped its attributes and aliases; they now update it in place.
geoscales 0.7.3
New features
geoscale_add_weight()declares a numeric weight over the atoms of an existing GeoScale –population,gdpor any other basis – so a hierarchy built with onlyareacan still apportion a quantity sensibly. Takes named vectors or a data.frame keyed by the atom column, sets the default weight, and refuses a weight that leaves an atom without a value.geoscale_rule_action()reports what each of the seven rules does going up and going down, and whether a parent’s value is therefore divisible between its children. Onlysumis: a quantity splits by the weight, while a rate, a price or an invariant is replicated unchanged, andsdand the two share rules have no downward meaning and come backNArather than guessed at. It lets a consumer decide per column what a partial selection of children does to a parent’s value without asking its caller.
Bug fixes
-
prune_geoscale()gave each code another code’s geometry when the pruned leaftable was not already in nested order. The dissolve now happens before construction and the result is passed togeoscale_from_leaftable(), which permutes geometry with the rows it re-orders;attach_geometry_geoscale()binds positionally and cannot. - A map with a categorical
zfell through to ggplot2’shue_pal(), which put neighbouring hues on unrelated regions.gg_geoscale(type = "map")now picks a qualitative scale for a discrete fill, and a discrete viridis above six levels, where no qualitative set clears the contrast floors. - The stack fills by the ancestor at the coarsest geoframe rather than by the code of each plane, so a child carries its parent’s colour down the stack instead of every frame’s codes sharing one ramp.
geoscales 0.7.2
Breaking changes
-
gg_geoscale()replacesgeoscale_autoplot()andgeoscale_plot(): one function,type = c("icicle", "stack", "map"). The old names are gone.autoplot()returns the same figure;plot()now draws it and returns it invisibly, like baseplot(). - The value column is
zfor every figure (the map’sfill=is gone) and is required wheneverdatais given.labels=replaceslabel=. The map’stitle,subtitleandfill_labelare gone: add+ labs(title =, subtitle =, fill =). -
palette = NULLis each figure’s default scale;palette = NAadds none. The stack’s bring-your-own-scale spelling wasNULL. -
...goes to the figure’s drawing layer. An argument that belongs to anothertypeis an error.precisionapplies to the map as well as the stack. - The first argument of the plotting function and of
autoplot()isobject.
New features
-
geoscale_adjacent()builds the neighbour matrix of a geoframe from attached geometry: which of its codes border which.contiguitychooses between"queen"(contact of any dimension, so features meeting at one corner are neighbours) and"rook"(a shared border of non-zero length),withincuts every edge that crosses a coarser geoframe, andisolated = "nearest"joins an island to its closest permitted neighbour. This is whatnestedscales::cluster_contiguous(adjacency =)consumes.
geoscales 0.7.1
New features
-
geoscale_autoplot(type = "stack")gainsview = "pyramid", the mirror image of"perspective": the coarsest geoframe is the small top and the finest the wide base. -
geoscale_autoplot(type = "stack", outline = "zone")draws the borders of a coarser geoframe over every finer plane, so the groups it forms stay visible at the finer resolution;outline_colourandoutline_linewidthstyle them. -
gapaccepts one value per pair of planes, top to bottom. Under"perspective"and"pyramid"the spacing is scaled with the planes it separates, so it stays uniform relative to their size.
geoscales 0.7.0
Breaking changes
- Requires nestedscales 0.2.0.
- The class is now spelled
GeoScale(wasGeoscale), matchingNestedScale. Function names keep thegeoscale_prefix. Saved GeoScale objects embed the class name: rebuild any.rds/.rdathat holds one. No deprecation alias. - Leaftable rows are in nested order by default: sorted by geoframe, coarsest first, each in its member order, with unassigned codes last; geometry follows the rows.
row_order = "given"keeps the rows as supplied. - The
recast()method follows the generic’s new arguments:recast(x, scale, target, source = NULL, ...).
Deprecations
-
fromandtoare nowsourceandtargetin the navigation, map and recast functions (recast_geoscale(),recast_pairs(), the geoatom halves), matching nestedscales. The old names still work, with a deprecation warning, and will be removed in a later release.
geoscales 0.6.0
Breaking changes
-
geoscale_map(gs, from, to)now takes the Geoscale first and maps between two of its geoframes only; the map between two Geoscales isgeoscale_map_between(from, to). The registry follows the same split:register_geoscale_map(gs, from, to, map)/get_geoscale_map(gs, from, to)for geoframes of one object,register_geoscale_map_between(from, to, map)/get_geoscale_map_between(from, to)for two objects.list_geoscale_maps()andclear_geoscale_maps()are unchanged. No deprecation aliases. - The shared core package is now called nestedscales (formerly multiscales).
data-raw/iceland_wind.rds(used by the README and the “Get started” vignette) was re-stamped withdata-raw/restamp_iceland_wind.R.
New features
-
zoom_geoscale()builds a telescoping geoframe with full detail in a focus area and progressively coarser rings elsewhere. Its ordered input is namedgeoframes=to match the package vocabulary.
geoscales 0.5.4
The shared core
Geoscaleis now a subclass of thenestedscalesNestedScale. Every nestedscales verb accepts a Geoscale directly, and geometry follows any subset.@geoframesand the constructor are unchanged.-
Breaking: Geoscale objects saved with an earlier version must be rebuilt. An S7 object stores its class with it, so an old Geoscale is not a
NestedScale: simple accessors still answer, butrecast_geoscale(),filter_geoscale(),join_geoscale()and the other verbs fail with “xmust be a NestedScale object”. Rebuild it from its own stored parts:m <- attr(old, "meta") gs <- geoscale_from_leaftable(attr(old, "leaftable"), geoframes = attr(old, "geoframes"), weights = m$weights, name = m$name) if (!is.null(attr(old, "geometry"))) { gs <- attach_geometry_geoscale(gs, attr(old, "geometry")) } recast_geoscale(),join_geoscale(),geoscale_map(), the navigation verbs,filter_geoscale(),geoscale_share(),geoscale_coverage()and the rule and map registries now run onnestedscales. Results are unchanged. On lazy inputs (arrow, dtplyr)recast_geoscale()no longer scans the data for its warnings, and it accepts theregionkey asfrom.timescalesmoves fromImportstoSuggests. It was a hard dependency for exactly one symbol – therecast()generic – which is now owned bynestedscales. Installing geoscales no longer pulls in a calendar package andlubridate. timescales stays inSuggestsbecause the mirror-parity test compares the two packages’ export surfaces.nestedscalesis added toImportsand therecast()generic is re-exported from there.geoscales::recastresolves and dispatches onGeoscaleexactly as before; the source frame is stillfrom_geoframe, sincefromis the dispatch argument and names the scale.New rule
"share": share within parent. Each source region’s value over its parent-group total, keyed at the source geoframe –recast_geoscale(x, gs, from = "nuts3", to = "nuts0", rule = "share")gives each nuts3’s share of its country, summing to 1 per parent. The parent isto, or the newparent=argument (default: the geoframe abovefrom);frommust nest within it."logshare"is the same computation with a log-scale display intent. Mirrored in timescales.The stack and icicle data fills accept
rule = "share": each plane is coloured by its regions’ share within the nearest coarser plane it nests in (the coarsest by the grand total), legend “Share”."share"draws on a fixed linear 0..1 scale,"logshare"(the same computation) on a fixed log10 percent scale (0.01%..100%) for when sibling counts differ by orders of magnitude; fixed limits either way, so any two share figures are colour-comparable.palette = NULLplus your own scale overrides it.The default viridis palette option is
"H"(was"G"), and the icicle’s data fill now honourspalette=instead of hard-coding one.recast_pairs()aggregates data keyed by a pair of regions – transmission corridors, trade flows, commuting matrices. Both endpoints are mapped, pairs that land inside a single target region are dropped as internal, and the rest are aggregated by rule.directed = FALSEmergesA->BwithB->A.recast_from_geoatoms(weight =)now names a column ofx, so the weight can vary by identifier – a capacity-weighted efficiency differs by year and vintage. Previously only a column literally namedweightwas honoured.na_rm = TRUEinrecast_from_geoatoms()andrecast_pairs()reads anNAas “this member says nothing” instead of letting it make the whole groupNA. Only an all-NAgroup staysNA, and a weighted mean drops the weight of eachNAmember so the divisor still matches.ruleandweightaccept a named vector, one entry per value column. One slot of a model can hold an extensive and an intensive quantity side by side, which previously took two calls.summary()output now prints with its formatted view from user code: the localprintbinding S7 leaves in the namespace had captured theS3method()registration ofprint.summary_Geoscale, so the method was invisible outside the package. Registered against base’sprintin.onLoad(same fix in timescales).Icicle labels no longer overprint:
geoscale_autoplot()now draws labels widest-rectangle-first withcheck_overlap = TRUE(matching the timescales icicle), so narrow regions lose their label instead of smearing the band.Remotes:added to DESCRIPTION so CI andpakusers can resolve the GitHub-only timescales Import and energypal Suggests from GitHub (the packages are not on CRAN/r-universe yet). Drop the field at CRAN submission time.
Base-generic methods on Geoscale
-
summary()— the quantitative complement ofprint(): member and unassigned-atom counts, per-weight totals, sampled coverage (with the parent’s name), the adjacent-geoframe NESTING table (cross-cutting pairs flagged with offender counts), geometry status (sf-free). Returns a"summary_Geoscale"with its own print. -
names()— the geoframe names (identical togeoscale_geoframes()). -
as.data.frame()andggplot2::fortify()— the leaftable, soggplot(gs) + geom_*()works directly. All mirrored by the timescales twins.
geoscales 0.5.0
Hard-break release: the sibling APIs of timescales and geoscales were harmonized against each other (the pairing table and naming rules live in the stack-wide CONVENTIONS.md, “Sibling API mirror”). NO deprecation aliases are kept – old names are gone, not wrapped.
Breaking changes
- Registries follow
register_<class>_<thing>everywhere: thegeo_map/geo_rule/geo_providerregistry families are nowregister_geoscale_map/get_geoscale_map/list_geoscale_maps/clear_geoscale_maps,register_geoscale_rule/get_geoscale_rule/list_geoscale_rules/clear_geoscale_rules, andregister_geoscale_provider/get_geoscale_provider/list_geoscale_providers.GEO_RULESis nowGEOSCALE_RULES. - The deprecated shim family is REMOVED (29
geo_*aliases plusgeoscale_levels,is_valid_level,geoscale_from_leaves,CORE_LEVELS; archived underdrafts/). -
geoscale_regions(x, geoframe = NULL)–geoframenow defaults to the finest geoframe (the atoms). The required-geoframe rule is about arguments that take region CODES; this one only selects the output.
New
-
coords_to_region(x, gs, geoframe = NULL)– the spatial twin oftimescales::datetime_to_timeslice(): match point observations (sf/sfc or a data.frame withlon/latcolumns) to the regions whose geometry contains them;NAoutside every region. -
geoscale_leaftable(x)– exported accessor for the leaf table (stop reaching forx@leaftable).
geoscales 0.4.2
Breaking changes
- A filtered Geoscale is now book-kept as a SAMPLE (the spatial mirror of a partial calendar’s
year_fraction):filter_geoscale()writesmeta$coverage(per-weight kept fraction of the ROOT parent, so filters compose),meta$parent_totals(making coverage verifiable by the validator),meta$parent_name, and manglesmeta$nameto"parent[geoframe:codes]"– so two different samples of one parent can no longer poison each other’s crosswalk-registry entries or collide injoin_geoscale()column names.prune_geoscale()renames to"parent@geoframe"(theprune_calendar()convention), now preserves the FULL meta (crs,source,labels), reflects dropped unassigned atoms in coverage, and keeps attached geometry by dissolving it per new atom (keep_geometry = FALSEto opt out). Read the fraction with the newgeoscale_coverage(x, weight). Code that relied on a subset keeping its parent’s name can find the parent inmeta$parent_name.
New features
-
geom_geoscale()andtheme_geoscale(): composable ggplot2 choropleth layer and map theme, mirroringtimescales::geom_calendar()’s design (column-name arguments, one standardgeom_sf()layer, solid white background for dark-mode pages).plot()on a Geoscale now dispatches togeoscale_autoplot(). -
get_geo_map()andlist_geo_maps()complete the crosswalk registry;register_geo_map()/clear_geo_maps()gain examples. -
geoscale_geometry(),geom_geoscale()and the stack view gain an opt-inprecision=for snapping near-coincident boundaries before the dissolve (workaround for sources with floating-point-jittered shared edges; default off). -
geoscale_autoplot(type = "stack")draws the layer-stack view: one map plane per geoframe, the same atoms dissolved at every resolution (requires attached geometry). Points of view come as presets (view = "oblique"/"top-down"/"cavalier"/"cabinet"/"military"/ "isometric"/"dimetric"/"trimetric"/"perspective") or viaangle/ratio(oblique) and rawshear/depth;rotate=turns the plane in place (point North anywhere),direction=flips the stack, and the defaultgapleaves planes almost touching with a slight overlap. - The stack view takes data:
data/zcolour every plane by an atom-keyed value, recast onto each coarser plane withrecast_geoscale()(rule, default"weighted_mean") so the whole stack shares one continuous scale;labels=writes region names on chosen planes andpalette=picks the viridis option — orNULLto bring your own scale, e.g. energypal’s Global Wind Atlas colours on their absolute breaks. The stack canvas now hugs the content: tight x/y limits, left room sized to the geoframe names, legend pulled in close. - The structure icicle carries data too:
geoscale_autoplot(data =, z =)fills every band with the value recast to that geoframe (atoms keep their values, coarser bands aggregate byrule–"weighted_mean"default), with contrast-aware labels – the 2D twin of the stack’s data fill. The README gained a five-point “What geoscales offers” intro mirrored with timescales. - Stack guides and borders:
frame=draws each plane’s outline (its “sheet”) through the same projection,frame_fill=fills the sheets (best mostly transparent – glass panes), andconnectors=adds dashed corner-to-corner guides between planes – curved shapes become easy to read in oblique views.colour=/linewidth=style the region borders, recycled per plane (defaults"grey35"/0.2, ggplot2’s own sf polygon border). Same additions intimescales::calendar_autoplot(type = "stack"). The README front page shows it on Iceland’s onshore wind resource, clustered from the Global Wind Atlas per region (data-raw/iceland_wind.R; build walk-through invignette("geoscales")).
Bug fixes
-
geoscale_geometry()no longer fails with an opaque “differing number of rows” whensf::st_union()returns several parts for one code (seen with s2-invalid source polygons): the parts are collapsed into the code’s single dissolved geometry. Healing the source withsf::st_make_valid()before attaching remains the better fix.
Documentation
- The documentation is restructured to mirror timescales: the intro is a short 5-minute tour; new
vignette("concepts")(with the shared *scales glossary),vignette("data-structures")andvignette("data-manipulation")(including a runnable time-and-spacerecast()chain and backend examples); the plotting article is rewritten on the current API as “Visualization with ggplot2” with a real-map tour of Iceland built from Natural Earth, with area data attached (old URL redirects). Vignette code follows the stack-wide tidyverse +|>style; README drops the retired word “levels”.
geoscales 0.2.0.9000
First working line: the Geoscale class, a conserving conversion core mirroring timescales, navigation, plotting, and the Natural Earth provider – under one naming convention shared with timescales.
Breaking changes
-
Geoscale@levelsis now@geoframesand@leavesis@leaftable(@membersunchanged), matching timescales;level/levelsarguments aregeoframe/geoframesacross the API, and derived tables useparent_geoframe/child_geoframecolumns. - A value column with neither
rule=nor aregister_geo_rule()entry is now an error; the silentsumfallback is gone. - Materialised
recast_geoscale()results complete to the full target vocabulary in member order (NAwhere nothing landed); lazy backends return observed groups until collected. -
join_geoscale()attaches a label column named after the Geoscale, with membership and share/weight columns"<name>."-prefixed (meta$nameis now required for conversion and attach;geoscale_build()derives a default). Existing columns are never overwritten (error). - Conflicting registered per-column weights build one crosswalk per weight instead of silently splitting equally.
- The
recast()method argumentfrom_levelis nowfrom_geoframe.
New features
Conversion
-
recast_geoscale(x, gs, from, to, rule)converts between geoframes – aggregation and disaggregation as one operation through the atom layer, cross-cutting geoframes included; identifier (panel) columns are preserved as groups;to =also accepts another named Geoscale (targeting its atom layer via shared atom keys). -
recast_to_geoatoms()/recast_from_geoatoms()expose the route halves; chaining them across two Geoscales converts between region systems that share atom keys. -
geoscale_map(from, to, gs =, weight =)materialises the crosswalk (atom counts and weights per overlapping pair, within one Geoscale or across two);register_geo_map()installs exact crosswalks,clear_geo_maps()resets. - All converters run over
data.frame, tibble,data.table, dtplyr, and arrow inputs; results come back in the input’s class, and lazy inputs return the uncollected query unlesscollect = TRUE. - Rules
sum,weighted_mean,mean,copy, and (new)sd, each defined in both directions; per-column defaults viaregister_geo_rule()/get_geo_rule()/list_geo_rules()/clear_geo_rules();na_action = c("drop", "error", "keep")for partial coverage. - The
recast()generic (owned by timescales, now in Imports) chains time and space:x |> recast(cal_a, cal_b) |> recast(gs, to = "country"); the source geoframe is inferred fromx’s columns or passed asfrom_geoframe=.
Core, navigation, providers
-
Geoscale: an S7 class holding@leaftable(one row per atom),@geoframes(ordered coarsest first),@members, optional@geometry, and@meta; geoframes are partitions of atoms, not a tree, so cross-cutting region systems are first-class. - Construction layers:
geoscale_from_leaftable(),geoscale_build()(ragged parent-child crosswalks),geoscale_from_provider(); plusgeoscale_example(). - Navigation and subsetting:
geoscale_geoframes(),geoscale_regions(),geoscale_rank(),geoscale_family(),geoscale_nests(),geoscale_ancestry()(atom-mediated, never a transitive closure),geoscale_children()/_parents()/_descendants()/_ancestors(),geoscale_share(),filter_geoscale()/gs[geoframe, region],prune_geoscale(). Ageoframeargument is required throughout – codes are not unique across geoframes. - Geometry and plotting (
sfand ggplot2 in Suggests):attach_geometry_geoscale(),geoscale_geometry()(dissolve),add_area_geoscale(),geoscale_autoplot()(icicle, no geometry needed),geoscale_plot()(choropleth),geoscale_layout(). - Providers:
register_geo_provider()/get_geo_provider()/list_geo_providers(); Natural Earth viane_source()/ne_geoscale()with source and scale recorded inmeta. The package ships no maps and selects no boundaries; known Natural Earth pitfalls (iso_a3 == -99, unreliable areas at 1:110m) are handled.
Deprecations
Old names warn and forward; removal before 1.0: the geo_* family -> verb_geoscale() / geoscale_*() / register_geo_*() (e.g. geo_recast() -> recast_geoscale(), geo_levels() -> geoscale_geoframes()), and the 2026-08 lattice renames geoscale_from_leaves() -> geoscale_from_leaftable(), geoscale_levels() -> geoscale_geoframes(), is_valid_level() -> is_valid_geoframe(), CORE_LEVELS -> CORE_GEOFRAMES.
Documentation
-
vignette("geoscales")gains crosswalk, route-halves, attach, backends, and glossary sections; version files (DESCRIPTION,VERSION, NEWS) agree on 0.2.0.9000.
