library(dplyr) library(magrittr) library(stringr) library(ggplot2) devtools::load_all()
This file outputs an incidence time series from cumulative case count.
Read in the case counts from the sitrep and calculate overall infectivity at the current time.
cum_cases <- here::here("data/CaseCounts/drc", params$cases) %>% readr::read_csv() cum_cases$date <- lubridate::dmy(cum_cases$date)
According to the report on 17th May, the cumulative case count in Bikoro has reduced from 36 to 29. Ignore this point.
cum_cases <- cum_cases[ -nrow(cum_cases), ]
Assume a starting point.
cum_cases <- rbind(data.frame(date = lubridate::dmy("01/05/20180"), Bikoro = NA, Iboko = NA, Wangata = NA), cum_cases)
Fit a line to fill in missing data.
linear_fit <- select_if(cum_cases, is.numeric) %>% purrr:: map_dfr(function(x) { interpolate_missing_data(cum_incidence = data.frame(date = cum_cases$date, cases = x), method = "linear")}, .id = "district") linear_fit <- select(linear_fit, district, interpolated_date, interpolated_cases) %>% tidyr::spread(district, interpolated_cases)
BIKORO and Iboko are in Equateur province while Wangata is in Mbandaka province.
linear_fit$eq_cases <- linear_fit$Bikoro + linear_fit$Iboko linear_fit$mb_cases <- linear_fit$Wangata
And the incidence curve from the cumulative case count.
eq_incid <- c(linear_fit$eq_cases[1], diff(linear_fit$eq_cases)) mb_incid <- c(linear_fit$mb_cases[1], diff(linear_fit$mb_cases))
here::here("data/CaseCounts/drc", paste0("interpolated_", params$cases)) %>% readr::read_csv(x = linear_fit, path = .)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.