getChildren: Get Children

Description Usage Arguments Value

Description

This function takes a commodity tree and a vector of node ids and returns a vector of these nodes as well as all the descendants (or ancestors) of these nodes.

Usage

1
2
getChildren(commodityTree, parentColname, childColname, topNodes,
  parentFlag = TRUE)

Arguments

commodityTree

A data.table with parent and child node IDs (corresponding to the IDs in nodes) which specify the commodity tree structure.

parentColname

The column name of commodityTree which contains the ID of the parent node.

childColname

The column name of commodityTree which contains the ID of the child node.

topNodes

Vector containing the node names/ids for which the children are sought.

parentFlag

Logical. If TRUE (default) this function gets all descendants. If FALSE, it gets all ancestors.

Value

A numeric vector containing topNodes as well as all descendants (or ancestors) of topNodes.


SWS-Methodology/faoswsUtil documentation built on May 9, 2019, 11:53 a.m.