Learn R Programming

data.tree (version 1.1.0)

as.Node.BinaryTree: Convert a a SplitNode from the party package to a data.tree structure.

Description

Convert a a SplitNode from the party package to a data.tree structure.

Usage

# S3 method for BinaryTree
as.Node(x, ...)

Arguments

x

The BinaryTree

...

additional arguments (unused)

Examples

Run this code
library(party)
airq <- subset(airquality, !is.na(Ozone))
airct <- ctree(Ozone ~ ., data = airq, 
               controls = ctree_control(maxsurrogate = 3))
               
tree <- as.Node(airct)
tree

print(tree, 
      "label", 
      criterion = function(x) round(x$criterion$maxcriterion, 3),
      statistic = function(x) round(max(x$criterion$statistic), 3)
      )

FindNode(tree, 6)$path


Run the code above in your browser using DataLab