Criteria functions (and constructors thereof) for trimming and pruning tables.
all_zero_or_na(tr)all_zero(tr)
content_all_zeros_nas(tt, criteria = all_zero_or_na)
prune_empty_level(tt)
prune_zeros_only(tt)
low_obs_pruner(min, type = c("sum", "mean"))
TableRow (or related class). A TableRow object representing a single row within a populated table.
TableTree (or related class). A TableTree object representing a populated table.
function. Function which takes a TableRow object and returns TRUE
if that row should be removed. Defaults to all_zero_or_na
numeric(1). (lob_obs_pruner only). Miminum aggregate count value. Subtables whose combined/average count are below this threshhold will be pruned
character(1). How count values should be aggregated. Must be "sum"
(the default) or
"mean"
A logical value indicating whether tr
should be included (TRUE
) or pruned (FALSE
) during pruning.
all_zero_or_na
returns TRUE
(and thus indicates trimming/pruning)
for any non-LabelRow TableRow
which contain only any mix of NA
(including NaN
), 0
, Inf
and -Inf
values.
all_zero
returns TRUE
for any non-Label row which contains only (non-missing) zero values.
content_all_zeros_nas
Prunes a subtable if a) it has a content table with exactly one row in it, and
b) all_zero_or_na
returns TRUE
for that single content row. In practice, when the default
summary/content function was used, this represents pruning any subtable which corresponds to an empty set of
the input data (e.g., because a factor variable was used in split_rows_by
but not all levels
were present in the data).
prune_empty_level
combines all_zero_or_na
behavior for TableRow
objects,
content_all_zeros_nas
on content_table(tt)
for TableTree
objects, and an addition check
that returns TRUE
if the tt
has no children.
prune_zeros_only
behaves as prune_empty_levels
does, except that like all_zero
it
prunes only in the case of all non-missing zero values.
lob_obs_pruner
is a constructor function which, when called, returns a pruning criteria function
which will prune on content rows by comparing sum or mean (dictated by type
)of the count count portions
of the cell values (defined as the first value per cell regardless of how many values per cell there are)
against min
.