cmu-delphi / epiprocess

Tools for basic signal processing in epidemiology
https://cmu-delphi.github.io/epiprocess/
Other
13 stars 9 forks source link

`epix_as_of` working with strings #462

Open dsweber2 opened 4 months ago

dsweber2 commented 4 months ago

Unsure if worth the effort, but

archive |> epix_as_of("2021-06-01")
Error in `epix_as_of()`:
! `max_version` must have the same `class` vector as
  `epi_archive$DT$version`.

was not immediately clear to me that the solution was as_Date("2021-06-01"). We may want to add an automatic conversion to the same type as epi_archive$DT$Version.

brookslogan commented 2 months ago

This sounds great. I tried doing something like this a while ago in a general way with vctrs::vec_cast(), but unfortunately, it has some unfortunate date <-> datetime conversions allowed (despite it saying there should be an error if there is not a 1-to-1 mapping of the values and actually enforcing this with int <-> double). We should either