has_one_root: Has One Root

Description Usage Arguments Details Examples

Description

Helper method for validating a data.table object as a btree by checking for one root.

Usage

1
has_one_root(btree)

Arguments

btree

A data.table object with field ParentNodeId

Details

Returns TRUE if field ParentNodeId has exactly 1 NA value.

Examples

1
2
3
library(data.table)
mytree <- data.table(NodeId=c(1, 2, 3), ParentNodeId=c(NA, 1, 1))
has_one_root(mytree)

ben519/btree documentation built on May 12, 2019, 10:56 a.m.