Public fields
label
Text shown for the node.
data
Any R value attached to the node.
id
Optional identifier.
loader
NULL or function(node) returning children, called
the first time the node is expanded.
loaded
Has the loader run?
Active bindings
parent
The parent node (read-only).
children
Child nodes (read-only).
expanded
Is the node expanded? (assign to expand / collapse)
Methods
TreeNode$new()
Create a node. See tree_node().
Usage
TreeNode$new(
label,
children = list(),
data = NULL,
expanded = FALSE,
id = NULL,
loader = NULL
)
Arguments
label
Label.
children
Child nodes (or labels).
data
Attached value.
expanded
Start expanded?
id
Identifier.
loader
Lazy loader.
TreeNode$add()
Add a child.
Usage
TreeNode$add(node, data = NULL, expanded = FALSE)
Arguments
node
A TreeNode or a label.
data
Data for a node created from a label.
expanded
Expanded state for a node created from a label.
TreeNode$remove()
Detach the node from its parent.
TreeNode$clear()
Remove all children.
TreeNode$expand()
Expand the node (running the loader if needed).
TreeNode$collapse()
Collapse the node.
TreeNode$toggle()
Toggle between expanded and collapsed.
TreeNode$expandable()
Can the node be expanded?
TreeNode$depth()
Depth below the root (the root is 0).
TreeNode$ancestors()
Parent, grandparent, ... up to the root.
TreeNode$path()
Labels from the root to this node.
TreeNode$walk()
This node and all descendants (depth first).
TreeNode$find()
Find a descendant by id.
TreeNode$changed()
Notify the tree view that the node changed.
TreeNode$print()
Print the subtree.
TreeNode$clone()
The objects of this class are cloneable with this method.
Usage
TreeNode$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.