Define Hierarchical Subsets Within a Variable Format
Source:R/varformat_new.R, R/varformat_stba.R
add_subs.Rdadd_subs() creates a structured list of sub-definitions, used
to represent child elements under a parent label when building hierarchical
formats.
The attributes exhaustive and disjoint describe whether:
the subsets collectively cover the parent category (
exhaustive = TRUE), andthe subsets are mutually exclusive (
disjoint = TRUE).The three shorthand variants correspond to the most common combinations:
all_of()/davon()→ exhaustive and disjointsome_of()/darunter()→ non-exhaustive but disjointsome_overlap()/undzwar()→ non-exhaustive and overlapping
Usage
add_subs(..., label = NA_character_, exhaustive = TRUE, disjoint = TRUE)
ss(..., label = NA_character_, exhaustive = TRUE, disjoint = TRUE)
ss_all(..., label = "Of which")
ss_some(..., label = "Including")
ss_overlap(..., label = "Such as")
davon(..., label = "Davon")
darunter(..., label = "Darunter")
undzwar(..., label = "Und zwar")Source
Seitz, Michael J.: Tipps und Tricks zur Gestaltung von Tabellen. Wiesbaden 2., überarb. Aufl. 2010. Statist. Bundesamt. (URL: https://www.statistischebibliothek.de/mir/receive/DEMonografie_mods_00000239)
Arguments
- ...
Elements to include as subset definition. Each element is a formula or character string as defined in
new_format().- label
Character. A label that should be used for describing the subset in the output table.
- exhaustive
Logical. If
TRUE, subsets together cover the entire parent category (no elements are excluded). Defaults toTRUE.- disjoint
Logical. If
TRUE, subsets are mutually disjoint (no overlap between subsets). Defaults toTRUE.
Value
A list of subset definitions, with attributes subset_type = c(exhaustive = <logical>, disjoint = <logical>) and subset_label = <character>.
Details
These helper functions construct hierarchical subsets used as input to
new_format(). They describe how subcategories relate to their parent
category in terms of coverage (exhaustive) and overlap
(disjoint).
See also
new_format() for examples of how these subsets are used.