2DegreesInvesting/r2dii.climate.stress.test

Enable using the package in user-mode

maurolepore opened this issue · 2 comments

Right now the package lacks access to required files.

It works on devleoper mode because the project can
reach the source code under its root.

devtools::load_all()
#> ℹ Loading r2dii.climate.stress.test
packageVersion("r2dii.climate.stress.test")
#> [1] '0.0.0.9000'

here::here()
#> [1] "/home/mauro/git/r2dii.climate.stress.test"

x <- capture.output( # Suppress printed output
  run_stress_test_bonds()
)
#> Warning in filter_negative_late_and_sudden(data): Removed 21 rows because negative production compensation targets were set in late and sudden.
#>                    Negative absolute production is impossible

It fails on user-mode because non-standard files like
"./stress_test_model_functions.R" are not installed.

library(r2dii.climate.stress.test)
packageVersion("r2dii.climate.stress.test")
#> [1] '0.0.0.9000'

here::here()
#> [1] "/tmp/Rtmpps4U2j/reprex-13fe2228c38d7-super-sable"

x <- capture.output( # Suppress printed output
  run_stress_test_bonds()
)
#> Warning in file(filename, "r", encoding = encoding): cannot open file
#> 'stress_test_model_functions.R': No such file or directory
#> Error in file(filename, "r", encoding = encoding): cannot open the connection

While we decide what to do with non-standard files, I think we should move or copy
them to inst/ so they do install and we can use the package in user-mode, e.g.
to show examples in README or vignettes/.

Can we close this, given e669119

Yay!! This reprex shows the package does indeed run on user-mode! We can close this issue!

library(r2dii.climate.stress.test)
here::here()
#> [1] "/tmp/RtmpCqcmZn/reprex-4b140611a78e6-vain-paca"

x <- capture.output(# Suppress printed output
  run_stress_test("bonds"))
#> Warning in filter_negative_late_and_sudden(data): Removed 21 rows because negative production compensation targets were set in late and sudden.
#>                    Negative absolute production is impossible

Created on 2021-11-03 by the reprex package (v2.0.1)