query4: Query 4

query4R Documentation

Query 4

Description

This is a more flexible query - essentially, a user can specify a time frame, then investigate any variable of their choice.

Usage

query4(
  plot_type = "static",
  start = "outbreak_start",
  end = "most_recent",
  var = "new_cases",
  func = "sum",
  projection = "mercator",
  palette = "YlOrBr"
)

Arguments

plot_type

"static" | "dynamic"

start

The start date of the time frame; this can be specified with one of the following:

  • "outbreak_start": The default.

  • "05-22-2020": Any date string in the format "%m-%d-%Y".

  • c("new_cases" = 10000): The date when a variable first exceeded a threshold. This variable can be any of the numeric variables in the OWID COVID dataset found here: https://covid.ourworldindata.org/data/owid-covid-data.csv

end

The end date of the time frame; this can be specified with one of the following:

  • "most_recent": The default.

  • "07-20-2021": Any date string in the format "%m-%d-%Y".

  • c("new_deaths" = 1000): The date when a variable first exceeded a threshold.

var

"new_cases" | "new_deaths" | "new_vaccinations" - or any other numeric variable in the OWID COVID dataset found here: https://covid.ourworldindata.org/data/owid-covid-data.csv

func

"sum" | "mean" | "median" | "min" | "max"

projection

"mercator" | "globular" | "gilbert"

palette

"YlOrBr" or any sequential palette from RColorBrewer: "YlOrRd", "YlOrBr", "YlGnBu", "YlGn", "Reds", "RdPu", "Purples", "PuRd", "PuBuGn", "PuBu", "OrRd", "Oranges", "Greys", "Greens", "GnBu", "BuPu", "BuGn", "Blues".

Value

Either a static map produced with ggplot2 or a dynamic one produced with leaflet.

Examples

query4(plot_type = "static", start = "outbreak_start", end = "most_recent", var = "new_cases", func = "sum", projection = "mercator")
query4(plot_type = "dynamic", start = c("new_deaths" = 1000), end = "04-33-2021", var = "new_vaccinations", func = "median", projection = "gilbert")
query4(plot_type = "dynamic", start = "03-03-2020", end = c("population" = 30000), var = "new_cases", func = "max", projection = "globular")

tomzhang255/covidviz documentation built on May 15, 2022, 6:59 a.m.