getFoodData | R Documentation |
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.
getFoodData(timePointYears, oldSystemYears = NULL, newFoodCode = "5141", oldFoodCode = "141", commCodesCPC = NULL, areaCodesM49 = NULL)
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. |
A data.table containing the food data.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.