Get the value of one or several variables from the parent node. This is a helper
function that is usually used as input to mutate_mtg()
to get the values of the parent node
for all nodes.
parent( attribute, node = NULL, scale = NULL, symbol = NULL, link = NULL, filter_fun = NULL, continue = TRUE )
attribute | Any node attribute (as a character, an expression or a node callm see details) |
---|---|
node | The node (do not put something when used from |
scale | An integer vector for filtering the MTG scale of the parent (i.e. the SCALE column from the MTG classes). |
symbol | A character vector for filtering the names of the MTG symbol required for the parent (i.e. the SYMBOL column from the MTG classes). |
link | A character vector for filtering the |
filter_fun | Any filtering function taking a node as input, e.g. |
continue | If a parent is not of the right |
The attribute values from the parent of a node
The attribute
argument can be given as a string (e.g. attribute = "Length"), an
expression (e.g. attribute = Length) or a call to a node (e.g. attribute = node$Length).
All are equivalent because they evaluate the node given by the user or by the calling function.
This behavior is set to homogenize the grammar used in the calls of mutate_mtg()
.
This function returns the values of any attribute of the parent of a node. It is
mainly intended to be used in a call to mutate_mtg()
(see mutate_mtg()
doc for examples).
#> Warning: the condition has length > 1 and only the first element will be used#> Warning: the condition has length > 1 and only the first element will be used#> Warning: the condition has length > 1 and only the first element will be used#> Warning: the condition has length > 1 and only the first element will be used#> node_4 #> 4