getCommodityLevel: Get Commodity Level

Description Usage Arguments Value

Description

This function takes a commodity tree and provides the level of each commodity within that tree.

Usage

1
2
getCommodityLevel(commodityTree, parentColname, childColname,
  returnMinLevel = 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.

returnMinLevel

Logical. If a node exists at multiple processing levels, should the minimum level be returned? Or, should multiple records be returned for each level?

Value

A data.table with two columns: node (the ID of the commodity code) and level. A level of 0 indicates a top level node which is then processed into a level 1 node. Level 1 nodes are processed into level 2, and so on.


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