Description Usage Arguments Value Note Examples
View source: R/mtg_getters_shortcuts.R
Get attribute values from the terminal nodes of the descendants sub-tree of a node (i.e. the "leaves" in computer science terms).
1 2 3 4 5 6 7 8 |
attribute |
Any node attribute (as a character) |
node |
The MTG node |
scale |
An integer vector for filtering the |
symbol |
A character vector for filtering the children by the name of their |
link |
A character vector for filtering the |
filter_fun |
Any filtering function taking a node as input. |
The attribute values from the children of the node
This function is mainly intended to be used with mutate_mtg()
. In this case,
the node
argument can be left empty (or you can put node = node
equivalently).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | filepath= system.file("extdata", "simple_plant.mtg", package = "XploRer")
MTG = read_mtg(filepath)
# The MTG has two leaves (node_5 and node_7):
leaves("Length", node = MTG)
# We can check the function worked well by printing the symbols of each nodes:
print(MTG, ".symbol")
# If we need the terminal Internodes:
leaves("Length", node = MTG, symbol = "Internode")
# Or the leaves at a given scale:
print(MTG, ".scale")
leaves("Length", node = MTG, scale = 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.