children: Get the children of a node

Description Usage Arguments Value Examples

View source: R/children.R

Description

Get the children of a node

Usage

1
children(id, tree, n = Inf)

Arguments

id

numeric ids of nodes.

tree

a treedf data.frame, with columns id and parent_id at least.

n

number of levels to look down; n=1 gives the direct children, n=2 gives grand children (i.e. children of all children), etc.

Value

A vector of ids of the children of the focus node(s).

Examples

1
2
3
4
tree <- data.frame(id=c(1, 2, 3, 4), parent_id=c(NA, 1, 2, 2))
children(1, tree)
children(1, tree, n=1)
children(c(2,3), tree)

jiho/checkboxTreeInput documentation built on June 13, 2020, 10:29 a.m.