Overview

RtD3 creates interactive visualizations of rt estimates using JavaScript, React, and D3. Plots can be added to the RStudio Viewer, included in R Markdown documents, or embedded in a Shiny app.

This package is closely linked to the estimates produced by the EpiNow2 package, an open source resource for creating rt estimates.

Basic visualization

RtD3 is flexible and will attempt to generate an interactive visualization with whatever data set it receives. Columns must be in a standard format (detailed in the “Data Structure” documentation).

This example relies on estimates from epiforecasts covid-rt-estimates.

base_url <- 'https://raw.githubusercontent.com/epiforecasts/covid-rt-estimates/master/national/'

geoData <- rnaturalearth::ne_countries(returnclass = 'sf')

rtData <- list("Cases" = RtD3::readInEpiNow2(
  path = "https://raw.githubusercontent.com/epiforecasts/covid-rt-estimates/master/national/cases/summary",
  region_var = "country"
  ))

Rt data is passed to the visualization function in a JSON-like list of lists to allow for visualization of estimates from different data sources. Rt data should be prepared in the format {'Source':{'rtData':x, 'casesInfectionData':x, 'casesReportData':x, 'obsCasesData':x, 'summaryData':x}, ...}. All required datasets are then passed to the visualization function.

RtD3::summaryWidget(
  geoData = geoData,
  rtData = rtData,
)