2DegreesInvesting / tiltIndicator

Indicators for the TILT project
https://2degreesinvesting.github.io/tiltIndicator/
GNU General Public License v3.0
1 stars 1 forks source link

All `*profile*()` functions now warn if the user adjusts the `*threshold` arguments in any way #754

Closed maurolepore closed 3 months ago

maurolepore commented 3 months ago

Closes #753

This reduces the chances that the user will modify the thresholds by mistake.

NOTE. I see a failing check. It may be unrelated but I need to investigate.

reprex

devtools::load_all()
#> ℹ Loading tiltIndicator

companies <- example_companies()
scenarios <- example_scenarios(year = 2050)

# Using the default thresholds yields no warning
out <- sector_profile(companies, scenarios)

# Using the `*threshold` argument in any way yields a warning
out <- sector_profile(companies, scenarios, low_threshold = 1/4)
#> Warning: The default thresholds are generally the most useful.
#> ℹ Do you really need to adjust them?

out <- sector_profile(companies, scenarios, high_threshold = 1/4)
#> Warning: The default thresholds are generally the most useful.
#> ℹ Do you really need to adjust them?

# You get the warning for all indicators, and even if you use the same value
# as the default -- which isn't ideal but is simplest
formals(emissions_profile)
#> $companies
#> 
#> 
#> $co2
#> 
#> 
#> $low_threshold
#> 1/3
#> 
#> $high_threshold
#> 2/3

co2 <- example_products()
out <- emissions_profile(companies, co2, low_threshold = 1/3)
#> Warning: The default thresholds are generally the most useful.
#> ℹ Do you really need to adjust them?


TODO

EXCEPTIONS

maurolepore commented 3 months ago

Closing in favor of https://github.com/2DegreesInvesting/tiltWorkflows/pull/146