knitr::opts_chunk$set(echo = FALSE, eval = TRUE,
                      fig.width = 12, fig.height = 12,
                      message = FALSE,
                      warning = FALSE,
                      dpi = 400)

r if (show_title) paste0('#### ', stringr::str_to_title(region_name))

library(tibble)
library(knitr)
library(kableExtra)
library(here)

if (!exists("case_def")) {
  case_def <- "case"
}

if (!exists("report_growth")) {
  report_growth <- TRUE
}

r paste(c(rep("#", title_depth), paste0(" Summary (estimates as of the ", latest_date, ")")), collapse = "")

r paste0("*Table ", summary_tables + index, ": Latest estimates (as of the ", latest_date, ") of the number of confirmed ", case_def, "s by date of infection, the expected change in daily confirmed ", case_def, "s, the effective reproduction number, the doubling time (when negative this corresponds to the halving time), and the adjusted R-squared of the exponential fit. The mean and 90% credible interval is shown for each numeric estimate.*")

readRDS(here::here(file.path(region_path, region, "latest/region_summary.rds"))) %>% 
knitr::kable(col.names = c("", "Estimate"), booktabs = TRUE) %>% 
    kableExtra::kable_styling(latex_options = c("striped", "hold_position"),
                full_width = TRUE)

r paste(c(rep("#", title_depth), " Confirmed ", case_def, "s, their estimated date of infection, and time-varying reproduction number estimates"), collapse = "")

knitr::include_graphics(here::here(file.path(region_path, region, "latest/rt_cases_plot.png")))


r paste0("*Figure ", summary_figures + 1 + (index - 1) * 2, ": A.) Confirmed ", case_def, "s by date of report (bars) and their estimated date of infection. B.) Time-varying estimate of the effective reproduction number. Light ribbon = 90% credible interval; dark ribbon = the 50% credible interval. Estimates from existing data are shown up to the ", latest_date, ifelse(report_forecast, " from when forecasts are shown. These should be considered indicative only", ""), ". Confidence in the estimated values is indicated by translucency with increased translucency corresponding to reduced confidence. The vertical dashed line indicates the date of report generation.*")

r ifelse(report_growth, paste(c(rep("#", title_depth), " Time-varying rate of growth and doubling time"), collapse = ""), "")

knitr::include_graphics(here::here(file.path(region_path, region, "latest/rate_spread_plot.png")))


r ifelse(report_growth, paste0("*Figure ", summary_figures + 2 + (index - 1) * 2, ": A.) Time-varying estimate of the rate of growth, B.) Time-varying estimate of the doubling time in days (when negative this corresponds to the halving time), C.) The adjusted R-squared estimates indicating the goodness of fit of the exponential regression model (with values closer to 1 indicating a better fit). Estimates from existing data are shown up to the ", latest_date, ". Light ribbon = 90% credible interval; dark ribbon = the 50% credible interval. Confidence in the estimated values is indicated by translucency with increased translucency corresponding to reduced confidence.*"), "")



epiforecasts/EpiNow documentation built on Oct. 26, 2020, 2:38 p.m.