knitr::opts_chunk$set(echo = FALSE)
library(RtD3)
library(here)
library(data.table)
library(sf)

About

City level estimates of the time-varying reproduction number of Covid-19 produced using EpiNow2 based on data from brazil.io. Regional estimates for Brazil (along with a national estimate) are available here. Detail of the method used is given here, though the estimates shown here were derived using an approximate approach (direct de-convolution of observed cases) rather than the exact method used on epiforecasts.io and therefore should be considered indicative. The code and data supporting these estimates is available here. Estimates are available in a summarised form here.


Data sources

today <- Sys.Date()
# dropped as RtD3 is not functional without a shapefile and with a shapefile makes this to big to add to github.
# Load shapefile
geoData <- readRDS(here::here("data", "shapefile", "brazil-admin-2.rds"))
# Load case data
cases <- data.table::fread(here::here("data", "cases", paste0(today, ".csv")))
cases <- cases[, .(sovereignt = city, code = city_ibge_code)][,
                 .SD[1,], by = code]
# Link shapefile with case data to get region
geoData <- merge(geoData, cases, by = "sovereignt", all.x = FALSE)
# Load estimates
rtData <- list("Cases" = RtD3::readInEpiNow2(path = here::here("data", "rt", today)))
# Make interactive widget
RtD3::summaryWidget(rtData = rtData,
                    activeArea = "São Paulo",
                    downloadUrl = "https://github.com/epiforecasts/covid-rt-brazil-subregional")

Regional Breakdown

latest_date <- readRDS(here::here("data","rt", today, "latest_date.rds"))
case_def <- "case"
region_path <- NULL
standalone <- TRUE
interactive <- TRUE
report_forecast <- TRUE
summary_path <- file.path("data","rt", today)




epiforecasts/covid-rt-brazil-subregional documentation built on Nov. 27, 2020, 12:27 a.m.