Package: nestedscales 0.2.0.9000

Oleg Lugovoy

nestedscales: Nested Scales and Multi-Dimensional Indexes for Modeling

Provides multi-level discrete representations of data dimensions for modeling, data processing and visualization. A nested scale records its finest units (atoms) and their membership in coarser levels (frames), including nested, cross-cutting and partially covered relationships. Recasts tabular data between levels using explicit, direction-aware rules for sums, means, standard deviations, copying and within-parent shares. Also supports labeling, subsetting, combining scales into multi-dimensional indexes, clustering units and storing data with its scale metadata. Members may carry attributes (a calorific value, an emission factor) and aliases, resolved along the hierarchy and applied row by row, and a scale is exchanged as a language-neutral definition file: a 'JSON' header with inline, 'Arrow' or 'CSV' tables ('YAML' accepted), with a catalogue of the definitions installed packages ship. Forms the dimension-agnostic core of 'timescales' <https://github.com/optimal2050/timescales> (calendars) and 'geoscales' <https://github.com/optimal2050/geoscales> (regions), designed for optimization and simulation models.

Authors:Oleg Lugovoy [aut, cre]

nestedscales_0.2.0.9000.tar.gz
nestedscales_0.2.0.9000.zip(r-4.7-any)nestedscales_0.2.0.9000.zip(r-4.6-any)nestedscales_0.2.0.9000.zip(r-4.5-any)
nestedscales_0.2.0.9000.tgz(r-4.6-any)nestedscales_0.2.0.9000.tgz(r-4.5-any)
nestedscales_0.2.0.9000.tar.gz(r-4.7-any)nestedscales_0.2.0.9000.tar.gz(r-4.6-any)
nestedscales_0.2.0.9000.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
nestedscales/json (API)

# Install 'nestedscales' in R:
install.packages('nestedscales', repos = c('https://optimal2050.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/optimal2050/nestedscales/issues

Pkgdown/docs site:https://optimal2050.github.io

On CRAN:

Conda:

4.95 score 1 stars 9 scripts 13 downloads 106 exports 17 dependencies

Last updated from:268fa16ca1. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-develOK172
source / vignettesOK209
linux-releaseOK143
macos-releaseOK223
macos-oldrelOK447
windows-develOK122
windows-releaseOK124
windows-oldrelOK119
wasm-releaseOK110

Exports:as_scale_arrayas_scale_tableattach_aliases_scaleattach_attributes_scalebackend_bind_rowsbackend_distinctbackend_is_lazybackend_lazybackend_ofbackend_pullbackend_restorebackend_scanbackend_schemaclear_scale_dirsclear_scale_distancesclear_scale_mapsclear_scale_rulescluster_contiguouscluster_medoidscluster_scalecluster_sweepconvert_scalefilter_productfilter_scaleget_scale_distanceget_scale_mapget_scale_map_betweenget_scale_ruleis_valid_framejoin_productjoin_scalelist_scale_classeslist_scale_dirslist_scale_distanceslist_scale_mapslist_scale_rulesopen_scale_datasetproduct_atomsproduct_coverageproduct_framesproduct_keysproduct_sizeproduct_weightsprune_scaleread_scalerecastrecast_crosswalkrecast_from_atomsrecast_productrecast_scalerecast_to_atomsreconcile_scaleregister_scale_classregister_scale_dirregister_scale_distanceregister_scale_mapregister_scale_map_betweenregister_scale_rulescale_alias_propertyscale_aliasesscale_ancestorsscale_ancestryscale_atom_levelscale_atom_pairsSCALE_ATTRIBUTE_KINDSscale_attributesscale_axesscale_catalogscale_childrenscale_classscale_coveragescale_crossesscale_dataset_infoscale_descendantsscale_distanceSCALE_DISTANCESscale_examplescale_example2scale_familyscale_framesscale_from_leaftablescale_isscale_is_productscale_is_uniformscale_keyscale_leaftablescale_mapscale_map_betweenscale_matchscale_nestsscale_parentsscale_payload_collapsescale_payload_slicescale_productscale_product_classscale_rankscale_read_payloadscale_residualsSCALE_RULESscale_sharescale_unitsscale_vocabscale_weightsscale_write_payloadwrite_scalewrite_scale_dataset

Dependencies:clidplyrgenericsgluejsonlitelifecyclemagrittrpillarpkgconfigR6rlangS7tibbletidyselectutf8vctrswithr

Attributes, aliases and conversion
What problem does this solve? | The shipped taxonomy | Attributes are not weights | Attributes live at any frame, and resolve by nearest ancestor | Sources and provenance | Mass to energy, with the calorific value | Aggregate to carriers | Emissions, one-way | Where the numbers come from | Model commodity codes | Attaching the hierarchy, and colours | Country-specific values | Where next

Last update: 2026-10-21
Started: 2026-10-21

Get started with nestedscales
Representation | Transition rules | Labels | Subsets | Attributes and aliases | Definition files | Several dimensions | Further operations

Last update: 2026-10-21
Started: 2026-10-09

The NestedScale object
The object | The leaftable | Frames, members, ranks | The attribute table | The alias table | Weights and meta | What the validator guarantees | Definition files | The registry | Where to next?

Last update: 2026-10-21
Started: 2026-10-21

Readme and manuals

Help Manual

Help pageTopics
Subset a NestedScale[.NestedScale [.nestedscales::NestedScale
Data on scales as a dense arrayas_scale_array as_scale_table
Attach aliases to a scaleattach_aliases_scale
Attach physical attributes to a scaleattach_attributes_scale
Backends: the table types the verbs acceptbackend backend_bind_rows backend_distinct backend_is_lazy backend_lazy backend_of backend_pull backend_restore backend_scan backend_schema
Clear the registered crosswalksclear_scale_maps
Clear the rule registryclear_scale_rules
Cluster the units of a scale under a contiguity constraintcluster_contiguous
The representative unit of each clustercluster_medoids
Cluster the units of a scale into a new framecluster_scale
Cluster quality across a range of kcluster_sweep
Convert unit-keyed quantities with a member attributeconvert_scale
Subset a product componentwisefilter_product
Subset a NestedScale by unitfilter_scale
Look up a registered ruleget_scale_rule
Validate frame namesis_valid_frame
Attach every axis's labels to product-indexed datajoin_product
Attach scale labels and memberships to a datasetjoin_scale
List registered ruleslist_scale_rules
Open a scale-aware datasetopen_scale_dataset print.scale_dataset
Realise the atoms of a productproduct_atoms
Coverage of each axisproduct_coverage
Frames of each axisproduct_frames
The data key column of each axisproduct_keys
Size of a productproduct_size
Weight columns of each axisproduct_weights
Collapse a NestedScale to a coarser frameprune_scale
Recast data through a scalerecast
Recast values through a given crosswalkrecast_crosswalk
Recast data indexed by a product of scalesrecast_product
Recast values from one resolution to anotherrecast_scale
Recast unit data down to the atom layer, and backrecast_from_atoms recast_to_atoms
Check fine data against an independent parent totalreconcile_scale
Register a distanceclear_scale_distances get_scale_distance list_scale_distances register_scale_distance
Register / look up a direct crosswalkget_scale_map get_scale_map_between list_scale_maps register_scale_map register_scale_map_between
Register how a parameter should be recastregister_scale_rule
An alias property for a subclassscale_alias_property
Read the alias tablescale_aliases
Ancestry between all frame pairsscale_ancestry
The level at which a scale enumerates its atomsscale_atom_level
Atom-level correspondence between two framesscale_atom_pairs
Kinds of attributeSCALE_ATTRIBUTE_KINDS
Read attributes, resolved along the hierarchyscale_attributes
Axes of a productscale_axes
Shipped scale definitionsclear_scale_dirs list_scale_dirs register_scale_dir scale_catalog
The scale classes, for subclassing and dispatchscale_class scale_product_class
Coverage of a sampled NestedScalescale_coverage
Do two frames form a product?scale_crosses
Describe a stored dataset without opening it fullyscale_dataset_info
Distance between the units of a scalescale_distance
Built-in distancesSCALE_DISTANCES
A small example NestedScalescale_example
A second small example NestedScalescale_example2
Immediate parent-child table between two framesscale_family
Frames of a NestedScalenames.NestedScale scale_frames
Build a NestedScale from a flat table of atomsscale_from_leaftable
Is this a scale, or a product of scales?scale_is scale_is_product
Are the units of a frame the same size?scale_is_uniform
The atom key column namescale_key
The leaftable of a NestedScaleas.data.frame.NestedScale as.data.frame.nestedscales::NestedScale scale_leaftable
Crosswalk between two frames of a scalescale_map
Crosswalk between two scales through their shared atomsscale_map_between
Match labels to members, strictlyscale_match
Navigate a NestedScale's hierarchyscale_ancestors scale_children scale_descendants scale_navigate scale_parents
Do two frames nest?scale_nests
Collapse a subclass's per-atom payloadscale_payload_collapse
Write and read a subclass's payload in a definition filelist_scale_classes register_scale_class scale_payload_io scale_read_payload scale_write_payload
Subset a subclass's per-atom payloadscale_payload_slice
Combine scales into a product indexscale_product
Frame rankscale_rank
Units that are residualsscale_residuals
Supported aggregation rulesSCALE_RULES
Weight shares within a framescale_share
Units of a NestedScalescale_units
The dimension vocabulary of a scalescale_vocab
Weight columns of a NestedScalescale_weights
Shipped definitions: 'carriers' and the IPCC 2006 fuel defaultsshipped_scales
Summarize a NestedScaleprint.summary_Scale summary.NestedScale summary.nestedscales::NestedScale
Summarize a productprint.summary_ScaleProduct summary.nestedscales::ScaleProduct summary.ScaleProduct
Write a scale as a definition file, and read one backread_scale write_scale
Write data and the scales that index it to one folderwrite_scale_dataset