Learn R Programming

cards (version 0.6.1)

sort_ard_hierarchical: Sort Stacked Hierarchical ARDs

Description

[Experimental]

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.

Usage

sort_ard_hierarchical(x, sort = c("descending", "alphanumeric"))

Value

an ARD data frame of class 'card'

Arguments

x

(card)
a stacked hierarchical ARD of class 'card' created using ard_stack_hierarchical() or ard_stack_hierarchical_count().

sort

(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".

See Also

filter_ard_hierarchical()