incidence2
incidence2 copied to clipboard
`plot()` and `facet_plot()` scaling issues due to `interval` and `show_cases = TRUE`
trafficstars
Please place an "x" in all the boxes that apply
- [x] I have the most recent version of incidence2 and R
- [x] I have found a bug
- [x] I have a reproducible example
- [ ] I want to request a new feature
When using the argument show_cases = TRUE, the image renders incorrectly using the "week" interval.
library(tidyverse)
library(outbreaks)
library(incidence2)
measles_data <- measles_hagelloch_1861 %>%
tibble()
raw_incidence_week <- incidence(
measles_data,
date_of_prodrome,
interval = "week",
groups = c(gender, class)
)
raw_incidence_day <- incidence(
measles_data,
date_of_prodrome,
interval = "day",
groups = c(gender, class)
)
# No issues
raw_incidence_day %>%
plot(
show_cases = TRUE
)
#> plot() can only stack/dodge by one variable.
#> For multi-facet plotting try facet_plot()

# Issues
raw_incidence_week %>%
plot(
show_cases = TRUE
)
#> plot() can only stack/dodge by one variable.
#> For multi-facet plotting try facet_plot()

# No issues
raw_incidence_week %>%
plot(
show_cases = FALSE
)
#> plot() can only stack/dodge by one variable.
#> For multi-facet plotting try facet_plot()

Created on 2021-11-23 by the reprex package (v2.0.1)
---------
@arnold-c - Cheers for the report. A little tied up with other work at the moment but will take a look when time permits.
Closing as show_cases is no longer a parameter as of https://github.com/reconverse/incidence2/commit/1ef0420a031462eb252d69046fd6fc8f8f1b6c82