reconverse/incidence2

`plot.incidence2()` fails with `grates_period` dates

Closed this issue · 3 comments

Opening here because I found out while using incidence2 but my understanding is that it's more likely a grates issue so feel free to transfer the issue.

Reprex:

library(outbreaks)
library(incidence2)
#> Loading required package: grates

raw_dat <- ebola_sim_clean$linelist

dat <- incidence(
  raw_dat, 
  date_index = "date_of_onset",
  interval = 1
)

plot(dat)
#> Error in scale_fun(n.breaks = n_breaks): Please provide a value of `n` corresponding to the given data

class(dat$date_index)
#> [1] "grates_period"

Created on 2023-12-04 with reprex v2.0.2

This is the correct place as AFAICT all is still OK in {grates}. Is there any chance you've tried this example previously and had it working? Something odd is happening and the scale_type method is is not being called so need to find out why 😕

T'was me that broke it in the last update. I've patched it over in https://github.com/reconverse/incidence2/tree/fix%23110. Can you install that branch and let me know if all seems ok. If so I'll push a patch release in the next couple of days (data.table multi threading issues permitting).

Yes, this fixes the problem I saw. Thanks for the quick answer!