Clean CSV data from the given file_path
.
Arguments
- file_path
The local path where the input CSV is located. It is recommended to use an autogenerated path by
get_file_path()
function.
Value
A tibble with the commodity balance sheet data in wide format. It contains the following columns:
year
: The year in which the recorded event occurred.area_code
: The code of the country where the data is from. For code details see e.g.add_area_name()
.item_cbs_code
: FAOSTAT internal code for each item. For code details see e.g.add_item_cbs_name()
.
The other columns are quantities (measured in tonnes), where total supply and total use should be balanced.
For supply:
production
: Produced locally.import
: Obtained from importing from other countries.stock_retrieval
: Available as net stock from previous years. For ease, only one stock column is included here as supply. If the value is positive, there is a stock quantity available as supply. Otherwise, it means a larger quantity was stored for later years and cannot be used as supply, having to deduce it from total supply. Since in this case it is negative, the total supply is still computed as the sum of all of these.
For use:
food
: Food for humans.feed
: Food for animals.export
: Released as export for other countries.seed
: Intended for new production.processing
: The product will be used to obtain other subproducts.other_uses
: Any other use not included in the above ones.
There is an additional column domestic_supply
which is computed as the
total use excluding export
.
Examples
if (FALSE) { # \dontrun{
get_wide_cbs(get_file_path("commodity_balance_sheet"))
} # }