Learn R Programming

data.tree (version 0.2.0-3)

Traverse: Traverse a tree or a sub-tree

Description

Traverse a tree or a sub-tree

Usage

Traverse(node, traversal = c("pre-order", "post-order", "in-order", "level",
  "ancestor"), pruneFun = NULL, filterFun = NULL)

Arguments

node

the root of a tree or a sub-tree that should be traversed

traversal

any of 'pre-order' (the default), 'post-order', 'in-order', 'level', or 'ancestor'

pruneFun

allows providing a a prune criteria, i.e. a function taking a Node as an input, and returning TRUE or FALSE. If the pruneFun returns FALSE for a Node, then the Node and all its sub-tree will not be considered.

filterFun

allows providing a a filter, i.e. a function taking a Node as an input, and returning TRUE or FALSE. Note that if filter returns FALSE, then the node will be excluded from the result (but not the entire subtree).

Value

a list of Nodes