reconhub / incidence

☣:chart_with_upwards_trend::chart_with_downwards_trend:☣ Compute and visualise incidence
https://reconhub.github.io/incidence
Other
58 stars 13 forks source link

incidence objects will drop groupings with zero days #117

Open zkamvar opened 4 years ago

zkamvar commented 4 years ago

This makes things difficult for users if they want to acknowledge that there exists a group that they haven't yet sampled.

g <- factor("watermelon", levels = c("watermelon", "cantaloupe"))
i <- incidence::incidence(Sys.Date(), group = g)
incidence::get_counts(i)
#>      watermelon
#> [1,]          1
i
#> <incidence object>
#> [1 cases from days 2020-01-23 to 2020-01-23]
#> [1 groups: watermelon]
#> 
#> $counts: matrix with 1 rows and 1 columns
#> $n: 1 cases in total
#> $dates: 1 dates marking the left-side of bins
#> $interval: 1 day
#> $timespan: 1 days
#> $cumulative: FALSE

Created on 2020-01-23 by the reprex package (v0.3.0)