cmu-delphi / epidatr

Delphi Epidata API R Client
https://cmu-delphi.github.io/epidatr/
Other
1 stars 5 forks source link

`clear_cache` removes logfile, which causes errors when the cache tries to write to it #196

Closed dshemetov closed 11 months ago

dshemetov commented 11 months ago

This works

epidatr::set_cache(here::here("cache", "epidatr"), confirm = FALSE)
epidatr::clear_cache(cache_dir = here::here("cache", "epidatr"), confirm = FALSE)
epidatr::pub_covidcast(
      "hhs",
      "confirmed_admissions_influenza_1d",
      "state",
      "day",
      "*",
      epirange(20230901, 20230910),
      as_of = 20230901
    )

but this doesn't

epidatr::set_cache(here::here("cache", "epidatr"), confirm = FALSE)
epidatr::clear_cache()
epidatr::pub_covidcast(
      "hhs",
      "confirmed_admissions_influenza_1d",
      "state",
      "day",
      "*",
      epirange(20230901, 20230910),
      as_of = 20230901
    )

and it would be nice if it did. Not sure if we can somehow automatically pass the same previous-cache args over to clear_cache.

dsweber2 commented 11 months ago

This is working more or less as intended, as far as I can tell. It'll error out if you haven't created the directory, which does require an interactive R session.

dshemetov commented 11 months ago

Can't repro now. Ah well