Create and (Interactively) Modify Nested Hierarchies

Provides functionality to generate, (interactively) modify (by adding, removing and renaming nodes) and convert nested hierarchies between different formats. These tree like structures can be used to define for example complex hierarchical tables used for statistical disclosure control.


Travis build status Coverage status GitHub last commit GitHub code size in bytes Mentioned in Awesome Official Statistics

R-Package to (interactively) generate or modify (nested) hierarchies that are required as input for packages such as sdcTable or cellKey.

The package is in its early stages and may change in future versions. Still, any feedback/pull requests are very much welcome!


The latest version from CRAN can be installed via



The latest development-version can be installed directly via:

  repo = "bernhard-da/sdcHierarchies",
  dependencies = TRUE,
  build_opts = c("--no-resave-data", "--no-manual")


Please have a look at the package vignette sdcHierarchies::hier_vignette() or by clicking here or browse the automatically generated documentation.


Updates/Changes are listed here.


sdcHierarchies 0.18


  • new function hier_grid() that returns all combinations of levels (and optionally levels) of some hierarchies


  • fix references to hier_app() in vignette

sdcHierarchies 0.17


  • hier_match() returns a mapping between original and default codes, fixing issue #9
  • hier_to_tree() returns a hierarchy in default format for any object created for example with hier_convert(), fixing issue #10


  • correctly compute default codes, fixing issue #7
  • correctly convert to R code, fixing issue #8

sdcHierarchies 0.16

  • do not rely on data.tree
  • examples for all exported function
  • new function hier_display()
  • harmonize function arguments
  • first CRAN version

sdcHierarchies 0.15

  • preps for CRAN

sdcHierarchies 0.14

  • rename functions/methods to hier_xxx()
  • improve documentation
  • rewrite import of hrc-files from tau-argus in hier_import
  • improve test coverage

sdcHierarchies 0.13.2

  • code style improves

sdcHierarchies 0.13.1

  • various fixes and improvements;
  • rewrote h_min_contributing_codes()
  • started to add unit-tests

sdcHierarchies 0.13.0

  • in sdcHier_info(), the codes really contributing to a given node are computed and returned
  • sdcHier_convert() allows to return a data.table
  • sdcHier_convert() allows to return a list object suitable for sdcTable (format = "sdc")
  • sdcHier_import() allows to create a hierarchy from a list-input created from sdcHier_convert(..., format = "sdc")

sdcHierarchies 0.12.0

  • continuous integration using travis
  • check code is linted correctly
  • building docs using pkgsdown, site is here

sdcHierarchies 0.11.0

  • sdcHier_convert() can now convert a hierarchy to the format tau-argus understands using format='argus'
  • sdcHier_export() writes hierarchies in specific formats to disk
  • sdcHier_import() gained the ability to return sdc hierarchies from hrc-files in tau-argus format as well as from code and json
  • sdcHier_info() now shows the children of a node (if existing)
  • sdcHier() gained the feature to export hierarchies as json-encoded strings and hrc-files suitable as input for tau-argus
  • started with vignette that can be started with sdcHier_vignette()

sdcHierarchies 0.10.0

  • implement undo-feature in sdcHier()

sdcHierarchies 0.9.0

  • combine dynHier() and fixedHier() to sdcHier()

sdcHierarchies 0.8.0

  • sdcHier_convert() gained an argument path to write the output to a file
  • new function sdcHier_compute_fromList() to create a hierarchy from a named list
  • invisibly return results to avoid duplicated printing
  • start with tabbed interface for shiny-apps

sdcHierarchies 0.7.0

  • some bugfixes
  • removed argument full_names froms sdcHier_compute()
  • show code to generated hierarchies in dynHier() and fixedHier()

sdcHierarchies 0.6.0

  • fixes for shiny-Apps dynHier() and fixedHier()
  • renamed dim_by_position() to sdcHier_compute()
  • sdcHier_convert() can output the required code to compute the hierarchy

sdcHierarchies 0.5.0

  • sdcHier_convert() can output the json-code
  • fixes to documentation and shinyApps dynHier() and fixedHier()

sdcHierarchies 0.4.0

  • Functions (sdcHier_create(), sdcHier_add(), sdcHier_delete(), sdcHier_rename(), sdcHier_info(), sdcHier_nodenames() and sdcHier_convert()) dealing with creation and updating of nested hierarchies and extracting information have been added

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.19.1 by Bernhard Meindl, 6 months ago

Report a bug at

Browse source code at

Authors: Bernhard Meindl [aut, cre]

Documentation:   PDF Manual  

Task views: Official Statistics & Survey Methodology, Official Statistics & Survey Statistics

GPL-3 license

Imports shiny, shinyjs, shinyTree, jsonlite, rlang, data.table, cli, Rcpp

Depends on shinythemes

Suggests knitr, rmarkdown, testthat

Linking to Rcpp

Depended on by sdcTable.

Suggested by SmallCountRounding.

See at CRAN