Skip to contents

find a subset of the tree

Usage

# S4 method for class 'atctree'
x[i, j = 0]

Arguments

x

object of class atctree

i

label (ATC code) of focal node

j

generation (integer). 0: siblings, -1: children, -2: grandchildren, 1: parents etc

Value

an object of class atctree

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 the siblings of C01:
plot(h["C01",0], ATC_text=TRUE, stem_label=TRUE, leaf_label=TRUE)
#> Remember you can hover over nodes to see text
# plot descendents of P01 (as far as grandchildren): plot(h["P01",-2], stem_label=TRUE, leaf_label=TRUE) #> Remember you can hover over nodes to see text
# plot descendents of P01 (as far as great grandchildren): plot(h["P01",-3], stem_label=TRUE, leaf_label=TRUE) #> Remember you can hover over nodes to see text