Skip to content

Can't use as_of = <Date> with caching enabled #258

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

Closed
brookslogan opened this issue Feb 28, 2024 · 1 comment · Fixed by #259
Closed

Can't use as_of = <Date> with caching enabled #258

brookslogan opened this issue Feb 28, 2024 · 1 comment · Fixed by #259

Comments

@brookslogan
Copy link
Contributor

brookslogan commented Feb 28, 2024

Thanks to @XuedaShen for pointing this out.

library(epidatr)
#> ! epidatr cache is being used (set env var EPIDATR_USE_CACHE=FALSE if not
#>   intended).
#> ℹ The cache directory is ~/.cache/R/epidatr.
#> ℹ The cache will be cleared after 14 days and will be pruned if it exceeds 4096
#>   MB.
#> ℹ The log of cache transactions is stored at ~/.cache/R/epidatr/logfile.txt.
pub_covidcast(
  source = "hhs",
  signals = "confirmed_admissions_covid_1d_prop_7dav",
  geo_type = "state",
  time_type = "day",
  geo_values = "*",
  time_values = epirange(20201101, 20231231),
  as_of = as.Date("2024-02-28")
)
#> Error in charToDate(x): character string is not in a standard unambiguous format

Created on 2024-02-28 with reprex v2.0.2

This is from cache_epidata_call()->check_is_recent(), probably similar to check_is_cachable() in #194.

@brookslogan
Copy link
Contributor Author

>= is comparing a Date-class as_of to a %Y%m%d-formatted string, trying to convert the RHS to Date and having issues (a %Y-%m-%d string would work with the auto conversion, but not %Y%m%d. But %Y-%m-%d might have issues on other types of as_ofs).

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

Successfully merging a pull request may close this issue.

1 participant