find a subset of the tree
sub-atctree-method.Rdfind a subset of the tree
Details
The subset method for objects of class atctree uses a focal node and a specification of how many generations to accrue. The focal node is specified by an ATC code at any of the five levels (e.g. i="A01"). The generation is specified by integer j, signed positive for ancestors and negative for descendants.
Examples
h <- atctree(schema="full")
#more useful to use the full tree with this approach
# plot descendents of P01 (as far as grandchildren):
h["P01",-2] |> plot(stem_label=TRUE, leaf_label=TRUE)
#> Remember you can hover over nodes to see text
# plot descendents of P01 (as far as great grandchildren):
h["P01",-3] |> plot(stem_label=TRUE, leaf_label=FALSE)
#> Remember you can hover over nodes to see text
# plot descendents of parent of P01A:
h["P01A",1] |> plot(stem_label=TRUE, leaf_label=TRUE)
#> Remember you can hover over nodes to see text
# plot descendents of grandparent of P01A:
h["P01A",2] |> plot(stem_label=TRUE, leaf_label=TRUE)
#> Remember you can hover over nodes to see text