Sort substructure of a TableTree at a particular Path in the Tree.
sort_at_path(
tt,
path,
scorefun,
decreasing = NA,
na.pos = c("omit", "last", "first"),
.prev_path = character()
)A TableTree with the same structure as tt with the exception
that the requested sorting has been done at path
TableTree (or related class). A TableTree object representing a populated table.
character. A vector path for a position within the structure of a tabletree. Each element represents a subsequent choice amongst the children of the previous choice.
function. Scoring function, should accept the type of
children directly under the position at path (either VTableTree,
VTableRow, or VTableNodeInfo, which covers both) and return a numeric value
to be sorted.
logical(1). Should the the scores generated by
scorefun be sorted in decreasing order. If unset (the default of
NA), it is set to TRUE if the generated scores are numeric
and FALSE if they are characters.
character(1). What should be done with children (subtrees/rows)
with NA scores. Defaults to "omit", which removes them, other
allowed values are "last" and "first" which indicate where
they should be placed in the order.
character. Internal detail, do not set manually.
The path here can include "*" as a step, which means
that each child at that step will be separately sorted based on
scorefun and the remaining path entries. This can occur
multiple times in a path.