Learn R Programming

data.tree (version 0.2.0-3)

GetAttribute: Get an attribute from a Node.

Description

Get an attribute from a Node.

Usage

GetAttribute(node, attribute, ..., format = NULL,
  inheritFromAncestors = FALSE, nullAsNa = TRUE)

Arguments

node

The Node from which the attribute should be fetched.

attribute

determines what is collected. The attribute can be

  • a.) the name of a field of each Node in the tree

  • b.) the name of a method of each Node in the tree

  • c.) a function, whose first argument must be a Node

...

in case the attribute is a function or a method, the ellipsis is passed to it as additional arguments.

format

can be a function that transforms the collected values, e.g. for printing

inheritFromAncestors

if TRUE, then the path above a Node is searched to get the attribute in case it is NULL.

nullAsNa

If TRUE (the default), then NULL is returned as NA. Otherwise it is returned as NULL.

Examples

Run this code
# NOT RUN {
data(acme)
GetAttribute(acme$IT$Outsource, "cost")
# }

Run the code above in your browser using DataLab