getFoodData: Get Food Data

getFoodDataR Documentation

Get Food Data

Description

This function pulls in food data from the working system given a year range. It pulls data from two tables (FAOSTAT tables with the old food data and agriculture production with the new food data). These two tables are binded together after the data from the old system is converted to use codes from the new system.

Usage

getFoodData(timePointYears, oldSystemYears = NULL, newFoodCode = "5141",
  oldFoodCode = "141", commCodesCPC = NULL, areaCodesM49 = NULL)

Arguments

timePointYears

A numeric vector of years for which food data is required.

oldSystemYears

A numeric vector of years for which the food data should be pulled from the old system. This vector must be a subset of the timePointYears parameter. Additionally, the default (NULL) will be updated to contain all years of timePointYears that are less than 2012. This should be appropriate, as new data is now created after 2011 (at least at the time of writing this function).

newFoodCode

The element code for food in the new system.

oldFoodCode

The element code for food in the old system.

commCodesCPC

The commodity codes for the SUA elements. If NULL, all food commodities will be pulled. These codes should be in CPC.

areaCodesM49

See commCodesCPC These codes should be M49.

Value

A data.table containing the food data.


SWS-Methodology/faoswsFood documentation built on April 6, 2022, 1:37 p.m.