FindNodeGeneric: A more flexible variant of data.tree::FindNode(). This...

View source: R/helpers.R

FindNodeGenericR Documentation

A more flexible variant of data.tree::FindNode(). This implementation allows to set a traversal and search by arbitrary fields.

Description

'data.tree::Traverse' is used with the 'traversal' argument to produce an ordering of the nodes which is subsequently searched. The 'traversal' option therefore allows to exert some control over the order of results if the results are not unique.

Usage

FindNodeGeneric(node, value, field = "name", traversal = c("pre-order",
  "post-order", "in-order", "level", "ancestor"), all = F)

Arguments

node

The root node of the tree to be searched.

value

The value for which to seach.

field

The field to be searched. The fieldname is given as a string.

traversal

The order in which the tree should be traversed.

all

whether only the first match or all matches shall be returned

Value

Depending on the value of 'all' either a single node or a list of nodes. In the case that no match is found, 'NULL' is returned.


wamserma/VCD2R documentation built on May 20, 2023, 11:17 p.m.