Description Usage Arguments Value
This function takes an input dataset and commodity tree and standardizes the data according to the tree.
1 2 | standardizeTree(data, tree, elements, standParams, additiveElements = c(),
sugarHack = TRUE)
|
data |
A data.table object containing the data of interest. |
tree |
The commodity tree, specified as a data.table object. The columns should be childVar (the commodity code of the child), parentVar (the commodity code of the parent), extractionVar (numeric value specifying the extraction rate), and shareVar (numeric value specifying how the commodity should be split up). There are also two optional columns: targetVar (either "T", "B" or "F" indicating if that commodity is a target commodity, should be backward standardized, or should be forward standardized) and standDev (containing the standard deviation estimates which should be aggregated as well). If the target is missing, everything is assumed to be backward standardized. If no standDev is provided, a deviation of 0 is assumed. The actual names of the columns are specified in standParams. |
elements |
The element codes for nodes that should be standardized. These correspond to the different "elements" of the FBS, such as production, imports, exports, etc. |
standParams |
The parameters for standardization. These parameters provide information about the columns of data and tree, specifying (for example) which columns should be standardized, which columns represent parents/children, etc. |
sugarHack |
Logical. Indicates if the commodity tree should be edited by this program to give the correction standardization of sugar? This is a hack and should be fixed, but for now it is generally necessary. |
A data.table with the commodities standardized to the highest level in the tree.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.