This function is used to sort stacked hierarchical ARDs.
For the purposes of this function, we define a "variable group" as a combination of ARD rows grouped by the
combination of all their variable levels, but excluding any by
variables.
sort_ard_hierarchical(x, sort = c("descending", "alphanumeric"))
an ARD data frame of class 'card'
(card
)
a stacked hierarchical ARD of class 'card'
created using ard_stack_hierarchical()
or
ard_stack_hierarchical_count()
.
(string
)
type of sorting to perform. Value must be one of:
"alphanumeric"
- within each hierarchical section of the ARD, groups are ordered alphanumerically (i.e. A to Z)
by variable_level
text.
"descending"
- within each variable group of the ARD, count sums are calculated for each group and groups are
sorted in descending order by sum. If sort = "descending"
, the n
statistic is used to calculate variable
group sums if included in statistic
for all variables, otherwise p
is used. If neither n
nor p
are
present in x
for all variables, an error will occur.
Defaults to "descending"
.
filter_ard_hierarchical()