plotCommodityTrees: Plot Commodity Trees

Description Usage Arguments Value

View source: R/plotCommodityTrees.R

Description

This function generates plots for each of the commodity trees defined in a commodity tree object. A separate plot is given for each node that has no parent, and this should allow for the production of a wheat tree, a milk tree, etc.

Usage

1
2
3
plotCommodityTrees(commodityTree, parentColname, childColname,
  extractionColname, dir = getwd(), prefix = "commodity_tree",
  adjExtractionRates = TRUE)

Arguments

commodityTree

A data.table with parent and child node IDs (corresponding to the IDs in nodes) which specify the commodity tree structure. Additionally, there should be a column with extraction rate data and a column with shares data.

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.

extractionColname

The column name of commodityTree which contains the extraction rate data.

dir

The directory where the commodity trees should be saved.

prefix

The prefix to add to the name of the plot(s) which will be saved to dir. One plot is created for each commodity tree.

adjExtractionRates

Logical. Typically, the extraction rates are stored as percentages multiplied by 10000, i.e. 5 0.05*10000 = 500. If TRUE, the function converts them to percentages.

Value

No object is returned, but image files of the plots are written out to .png files. The input parameter dir specifies where these files will be placed.


SWS-Methodology/faoswsStandardization documentation built on Feb. 7, 2022, 5:05 a.m.