Assume that there are node labels and these may be non-unique.
We assign these labels by joining a lookup table of labels and edges
with the tree object, in this case the long array format.
Usage
match_branch_to_label(probs_long, probs_from_to_lookup)
Arguments
- probs_long
Long format array tree object
- probs_from_to_lookup
edge-label look-up table
Details
Separating the tree structure and labelling means that we can
reuse the same tree with different labels
e.g. another test or treatment
Examples
probs_long <-
tibble::tribble(~from, ~to, ~prob,
1, 2, 0.5,
1, 3, 0.5)
pname_from_to <-
tibble::tribble(~from, ~to, ~name,
1, 2, "pos",
1, 3, "neg")
match_branch_to_label(probs_long, pname_from_to)
#> from to name
#> 1 1 2 pos
#> 2 1 3 neg