Learn R Programming

data.tree (version 0.1.6)

Set: Traverse a Tree and Assign Values

Description

The method takes a vector as an argument. It traverses the tree, and assigns values to variables, whereby the values are picked from the vector.

Usage

Set(..., traversal = "pre-order", returnValues = FALSE)

Arguments

...
each argument can be a vector of values to be assigned.
traversal
any of 'pre-order', 'post-order', 'ancestor'
returnValues
if TRUE, then the non-processed arg passed in ... are returned. Otherwise the Node itself is returned for chaining. Mainly for internal use.

See Also

Node

Examples

Run this code
data(acme)
acme$Set(departmentId = 1:11,
         head = c("Jack Brown",
                  "Dr. Frank N. Stein",
                  "",
                  "",
                  "Mona Moneyhead",
                  "",
                  "",
                  "Eric Nerdahl",
                  "",
                  "",
                  ""))
print(acme, "departmentId", "head")

Run the code above in your browser using DataLab