sort_hierarchy: Sort data.table hierarchy for easier use of downstream...

View source: R/sort_hierarchy.R

sort_hierarchyR Documentation

Sort data.table hierarchy for easier use of downstream outputs

Description

Sorts the hierarchy by location hierarchy so that children follow parents and everything is alphabetical. In addition, arbitrary locations can be moved to the front for easy lookup in e.g., output PDFs.

Usage

sort_hierarchy(dt, prepend = NULL)

Arguments

dt

data.table instance. MUST have the following columns: location_id, path_to_top_parent

prepend

numeric vector of location_id values to prepend to the document. If provided, these values will be moved to the beginning of the result in the order provided and all other values will be sorted.


ihmeuw/ihme.covid documentation built on Nov. 2, 2022, 2:25 a.m.