fineprint-global / fabio

Food and Agriculture Biomass Input-Output Tables
Other
17 stars 14 forks source link

CBS building, rebalancing #34

Closed nk027 closed 4 years ago

nk027 commented 4 years ago

See also #33 and #32.

We currently balance the CBS via the balance column - formerly it was computed as total_supply - uses where total_supply < uses. Then we allocate the remainder of total_supply.

I'll recode balance = total_supply - uses and allocate positive values as before. Negative values will remain for now.

nk027 commented 4 years ago

The column is now constructed as:

cbs[, balancing := na_sum(total_supply, -stock_addition, -exports, -food, -feed, -seed, -losses, -processing, -other)]

This means negatives are in there. Positive values (after rebalancing) of it are moved to other columns: https://github.com/nk027/fabio/blob/034815a73ab1a13140a1032e1c1a36b1c7ad5298/R/2_build_cbs.R#L210