reconverse/incidence2

First trial comments

Closed this issue · 1 comments

These are comments or discussion items which in itself seem too small to warrant a dedicated issue. This issue is work in progress.

Doc

  • in ?incidence, specify that x can be a data.frame or a tibble, for the incidence functions, and that the indicated methods dispatch along the second argument (which is unusual, though very cool)

  • I love that the following works:

library(magrittr)
library(incidence2)
outbreaks::ebola_sim_clean$linelist %>%
  incidence(date_of_onset, groups = c(gender, hospital, outcome)) %>%
  pool(c(gender, outcome))
#> <incidence object>
#> [5829 cases from days 2014-04-07 to 2015-04-30]
#> [interval: 1 day]
#> [cumulative: FALSE]
#> 
#>    date_group gender outcome count
#>    <date>     <fct>  <fct>   <int>
#>  1 2014-04-07 f      Death       0
#>  2 2014-04-07 f      Recover     0
#>  3 2014-04-07 f      <NA>        1
#>  4 2014-04-07 m      Death       0
#>  5 2014-04-07 m      Recover     0
#>  6 2014-04-07 m      <NA>        0
#>  7 2014-04-08 f      Death       0
#>  8 2014-04-08 f      Recover     0
#>  9 2014-04-08 f      <NA>        0
#> 10 2014-04-08 m      Death       0
#> # … with 2,324 more rows

Going forward it would be nice to have a vignette dedicated to handling incidence objects and illustrate this feature, amongst others. Also, would it make sense to create an alias (or merely rename) for pool to regroup , as it might make more sense to people? Which makes me realise we have not decided on a policy for keeping names / creating new names.

Plotting

  • the message:
Error in plot_single(x, group, stack, color, col_pal, alpha, border, xlab,  : 
  A single plot can only stack/dodge one variable.
 Please `pool` the object first or use `plot_facet`

Should read facet_plot

  • the y-axis legend for interval = 14 reads semi-weekly (google has it as "twice a week"); I think bi-weekly may be better (google says it can be either "once every 2 weeks" or "twice a week")

#12 deals with pool to regroup renaming