elementNamesToCodes: Element Names to Codes

Description Usage Arguments Value

View source: R/elementNamesToCodes.R

Description

This function converts element names (such as production, imports, ...) into codes (such as 5510, 5321, etc.). It only works with the codes defined in this file on the share drive: paste0(R_SWS_SHARE_PATH,"/browningj/elementCodes.csv") (which will eventually become an adhoc table). The tricky part of this function is that the commodity type must be used to correctly choose the element code, as different commodities may use different codes for production, yield, ...

Usage

1
2
elementNamesToCodes(data, elementCol = NULL, itemCol = NULL,
  standParams = NULL)

Arguments

data

The data.table containing the codes to be mapped. It is assumed to have one column with element codes and one column with item codes.

elementCol

The column name of the column with element codes.

itemCol

The column name of the column with item codes.

standParams

A list of parameters (see faoswsStandardization::defaultStandardizationParameters). If supplied, elementCol and itemCol can be NULL.

Value

The passed data.table "data" but with an updated element column (with codes instead of names).


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