fineprint-global / fabio

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

Double values in Crop TCFs? #86

Closed nk027 closed 3 years ago

nk027 commented 4 years ago

Apparently the values from inst/tcf_cbs.csv are doubled when casted into the elements of Cs (see below). I was not able to reproduce this:

> tcf_cbs[area_code == 1, .(source_code, item_code, tcf)]                                       
   source_code item_code    tcf
1:        2514      2582 0.4500
2:        2620      2655 0.7200
3:        2536      2541 0.0900
4:        2536      2818 0.1012
5:        2537      2818 0.1288
6:        2805      2581 0.1400
> Cs[[1]]                                                                                       
5 x 5 sparse Matrix of class "dgCMatrix"
     2514   2536   2537 2620 2805
[1,] .    0.0900 .      .    .   
[2,] .    .      .      .    0.14
[3,] 0.45 .      .      .    .   
[4,] .    .      .      0.72 .   
[5,] .    0.1012 0.1288 .    .   

https://github.com/nk027/fabio/blob/bce1c4b3ef7b8bd107f279e9013a4c87fafaf6a2/R/7_use.R#L64

nk027 commented 3 years ago

This stemmed from https://github.com/nk027/fabio/issues/70 and is now fixed (affected a few countries).