Package 'RtD3'

Title: Rt Visualization in D3
Description: An R interface for the JavaScript library rt_vis(<https://github.com/hamishgibbs/rt_vis>).
Authors: Hamish Gibbs [aut, cre]
Maintainer: Hamish Gibbs <[email protected]>
License: MIT + file LICENSE
Version: 0.0.0.9000
Built: 2024-11-25 06:26:06 UTC
Source: https://github.com/epiforecasts/RtD3

Help Index


Get Subregional Estimate Urls

Description

Get Subregional Estimate Urls

Usage

getSubregionalUrls(path, areas)

Arguments

path

A character string container the overall path to subnational estimates

areas

A character vector listing the subregional estimates (assuming that listed in the geoData with capitalisation and without capitalisation in the path).

Value

A named list of subnational urls.

Examples

getSubregionalUrls(path = "https://epiforecasts.io/covid/posts/national/",
                  areas = c('Afghanistan', 'Brazil', 'Colombia', 'United States'))

Read in Results from EpiNow2

Description

Reads in results from EpiNow2 and converts them into the RtD3 format. Supports either input via a list object or from a file path/url.

Usage

readInEpiNow2(input_list, path, region_var = "region")

Arguments

input_list

A list of results as returned by EpiNow2::regional_summary

path

A character string indicating the path (either file or URL) to the summary results

region_var

A character string that identifies the region name used.

Value

A named list in the format required by summaryWidget along with a summary table.

Examples

# Read in each summary folder

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

rtData

summaryWidget

Description

Create an Rt visualisation using D3

Usage

summaryWidget(
  geoData = NULL,
  rtData = NULL,
  activeArea = NULL,
  activeTime = "all",
  runDate = NULL,
  subregional_ref = NULL,
  width = 900,
  elementId = NULL,
  dryRun = FALSE
)

Arguments

geoData

sf object, map data

rtData

data.frame, rt estimates in the format 'Source':'rtData':x, 'casesInfectionData':x, 'casesReportData':x, 'obsCasesData':x, ...

activeArea

character, the default area to plot.

activeTime

character, the default time window (defaults to 'all')

runDate

character, date of estimate run in the format ('YYYY-MM-DD')

subregional_ref

list, reference to subnational estimates in the format 'country_name':'url', ....

width

integer, width in pixels

elementId

string, id of element

dryRun

Logical, defaults to FALSE. Should the function be tested without the widget being created. Useful for checking the integrity of input data.


Shiny bindings for summaryWidget

Description

Output and render functions for using summaryWidget within Shiny applications and interactive Rmd documents.

Usage

summaryWidgetOutput(outputId, width = "100%", height = "400px")

rendersummaryWidget(expr, env = parent.frame(), quoted = FALSE)

Arguments

outputId

output variable to read from

width, height

Must be a valid CSS unit (like '100%', '400px', 'auto') or a number, which will be coerced to a string and have 'px' appended.

expr

An expression that generates a RtD3

env

The environment in which to evaluate expr.

quoted

Is expr a quoted expression (with quote())? This is useful if you want to save an expression in a variable.