pik-piam / quitte

Bits and pieces of code to use with quitte-style data frames
0 stars 10 forks source link

add explicit error if calc_addVariables() is missing some variables completely #53

Closed 0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q closed 1 year ago

0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q commented 1 year ago

Looks like

df.plot.decomb %>% 
    filter('COFFEE 1.3' != model) %>% 
    calc_addVariable(
        "`Final Energy|Industry|Iron and Steel|Residual Fossil Fuel`" =
            " `Final Energy|Industry|Iron and Steel|Solids|Coal`
            + `Final Energy|Industry|Iron and Steel|Liquids|Fossil`
            + `Final Energy|Industry|Iron and Steel|Gases|Fossil`
            + `Final Energy|Non-Energy Use|Iron and Steel|Solids|Coal`
            + `Final Energy|Non-Energy Use|Iron and Steel|Liquids|Fossil`
            + `Final Energy|Non-Energy Use|Iron and Steel|Gases|Fossil`",
        units = "EJ / yr", completeMissing = TRUE, only.new = TRUE)
Error in calc_addVariable_(data, .dots, na.rm, completeMissing, only.new, : 
3 variables are missing for the calculation:
 `Final Energy|Non-Energy Use|Iron and Steel|Solids|Coal`
 `Final Energy|Non-Energy Use|Iron and Steel|Liquids|Fossil`
 `Final Energy|Non-Energy Use|Iron and Steel|Gases|Fossil`
nicobauer commented 1 year ago

Thanks a lot!