Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring scenario_demo_2020 from r2dii.scenario #37

Closed
maurolepore opened this issue Apr 2, 2020 · 5 comments
Closed

Bring scenario_demo_2020 from r2dii.scenario #37

maurolepore opened this issue Apr 2, 2020 · 5 comments
Assignees

Comments

@maurolepore
Copy link
Contributor

maurolepore commented Apr 2, 2020

See https://github.com/2DegreesInvesting/r2dii.scenario/blob/master/data-raw/scenario_demo.R

@maurolepore maurolepore self-assigned this Apr 2, 2020
@jdhoffa
Copy link
Member

jdhoffa commented Apr 2, 2020

make sure that it's scenario_demo_2020 that comes out! it must be prepared by the year

@maurolepore maurolepore changed the title Bring scenario_demo from r2dii.scenario Bring scenario_demo_2020 from r2dii.scenario Apr 2, 2020
@maurolepore
Copy link
Contributor Author

maurolepore commented Apr 2, 2020

Add scenario_demo_2020

  • Add "data-raw/scenario_demo_2020.csv"
  • Add "data-raw/data_dictionary/scenario_demo_2020.csv"
  • In "data-raw/scenario_demo_2020.R", add something like:
    # Source: @<contributor> <URL to issue or pull request>
    scenario_demo_2020 <- readr::read_csv(here::here("data-raw", "scenario_demo_2020.csv"))
    use_data(scenario_demo_2020, overwrite = TRUE)
    
  • usethis::use_r("scenario_demo_2020"). Document scenario_demo_2020
  • usethis::use_test("scenario_demo_2020"). Add regression tests of scenario_demo_2020
  • source("data-raw/data_dictionary.R"); devtools::load_all()
  • usethis::use_test("data_dictionary"). Test data_dictionary includes scenario_demo_2020

--

@jdhoffa:

  1. Can you add the data dictionary?
  2. Do we need raw_scenario_demo?
  3. Can you describe scenario_demo_2020 in its helpfile?

Also,

a. The code we use to create scenario_demo uses r2dii.scenario, which is still in early development and might change in ways that compromise the reproducibility of scenario_demo. I'm not sure what's the best approach. Maybe we need to bring the relevant code to r2dii.data/data-raw until r2dii.scenario is more stable? Or we may tag a good commit of r2dii.scenario and create a github release.

@jdhoffa
Copy link
Member

jdhoffa commented Apr 3, 2020

  1. Done
  2. We do not, I want to work on this file a bit more before including in r2dii.data
  3. Almost complete.

TODO:

  • Add @format to scenario_demo_2020.R (I wasn't sure how you systematically generate this from the data_dictionary entry, could you show me?)

a. r2dii.scenario is unstable and r2dii.scenario::raw_scenario_demo is unstable, however scenario_demo_2020 is stable (in my opinion). Any changes to how we generate this file shouldn't change the format of the file, this is why i felt comfortable including it in r2dii.data. We could try to remove the dependency on r2dii.scenario::add_market_share_columns() altogether by including only scenario_demo_2020.csv itself in data-raw, what do you think?

@maurolepore
Copy link
Contributor Author

maurolepore commented Apr 3, 2020

We could try to remove the dependency on r2dii.scenario::add_market_share_columns() altogether by including only scenario_demo_2020.csv itself in data-raw, what do you think?

I'm not worried about the dependency because we call from data-raw/, which isn't checked by R CMD check. I'm worried about not being able to reproduce scenario_demo_2020.csv later on, or to reproduce but with a lot of work, like digging in the git repo of r2dii.scenario for a commit that can indeed reproduce.

To be safe and clean I suggest this:

@jdhoffa:

  • Find a good commit where the r2dii.scenario with the relevant code passes R CMD check cleanly and share that commit with me.
  • Increment the dev version number, tag the commit, and create a github release. I can do this but I suspect you'll enjoy playing with use_github_release() or
git tag -a 0.0.900x -m "Tag good commit for scenario_demo_2020"
git push upstream 0.0.900x

Then https://github.com/2DegreesInvesting/r2dii.scenario/releases

me:

  • Copy the relevant code to r2dii.data and commit. This ensures that whatever happens with
    r2dii.scenario (even if we kill the repo) the code will be easy to recover.
  • Remove the relevant code and point to the code in r2dii.scenario as we do now, except that
    we can link to the specific github release (i.e. git tag).
  • Sleep well.

@jdhoffa
Copy link
Member

jdhoffa commented Apr 3, 2020

Release 0.0.9001 of r2dii.scenario now stable-ish (passes R CMD check) boo-yah.

maurolepore added a commit that referenced this issue Apr 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants