Я использовал эту статью, чтобы воспроизвести сюжеты. Это сработало очень просто. Сегодня я пытался использовать тот же код, и он больше не работал, и я не знаю почему ... Я проверил код, и все в порядке ...
код:
library('outbreaks')
dat1 <- ebola_sim_clean$linelist
str(dat1, strict.width = "cut", width = 76)
## 'data.frame': 5829 obs. of 9 variables:
## $ case_id : chr "d1fafd" "53371b" "f5c3d8" "6c286a" ...
## $ generation : int 0 1 1 2 2 0 3 3 2 3 ...
## $ date_of_infection : Date, format: NA "2014-04-09" ...
## $ date_of_onset : Date, format: "2014-04-07" "2014-04-15" ...
## $ date_of_hospitalisation : Date, format: "2014-04-17" "2014-04-20" ...
## $ date_of_outcome : Date, format: "2014-04-19" NA ...
## $ outcome : Factor w/ 2 levels "Death","Recover": NA NA 2 ..
## $ gender : Factor w/ 2 levels "f","m": 1 2 1 1 1 1 1 1 2 ..
## $ hospital : Factor w/ 5 levels "Connaught Hospital",..: 2 ..
library('incidence')
library('ggplot2')
# compute weekly stratified incidence
i.7.group <- incidence(dat1$date_of_onset, interval = 7, groups = dat1$hospital)
# print incidence object
i.7.group
## <incidence object>
## [5829 cases from days 2014-04-07 to 2015-04-27]
## [5829 cases from ISO weeks 2014-W15 to 2015-W18]
## [6 groups: Connaught Hospital, Military Hospital, other,
## Princess Christian Maternity Hospital (PCMH), Rokupa Hospital, NA]
##
## $counts: matrix with 56 rows and 6 columns
## $n: 5829 cases in total
## $dates: 56 dates marking the left-side of bins
## $interval: 7 days
## $timespan: 386 days
## $cumulative: FALSE
# plot incidence object
my_theme <- theme_bw(base_size = 12) +
theme(panel.grid.minor = element_blank()) +
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5, color = "black"))
plot(i.7.group, border = "white") +
my_theme +
theme(legend.position = c(0.8, 0.75))
график, который я должен получить 
график, который я получаю:
сообщение об ошибке:
Warning message:
position_stack requires non-overlapping x intervals
Я использую ggplot2 версии 3.3.0
Как вы думаете? Как я могу это исправить?