query5: Query 5

query5R Documentation

Query 5

Description

Produces a time-series line plot of a variable for either one country or multiple countries. Time frame can be a custom argument. User has the option to down-sample by grouping time frame by week or month; if that is the case, then either an error bar plot or box plot is produced.

Usage

query5(
  plot_type = "static",
  var = "new_cases",
  country = "United States",
  start = NULL,
  end = NULL,
  group_by = NULL,
  bar_type = "error",
  palette = NULL
)

Arguments

plot_type

"static" | "dynamic"

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

country

"United States" | "Canada" | "United Kingdom" - or any other country name.

start

The start date of the time frame; by default (NULL) starts from the first available record in the OWID COVID dataset. Or specify any date string in the format "%m-%d-%Y" such as "05-22-2020".

end

The end date of the time frame; by default (NULL) includes the most recent record in the OWID COVID dataset. Or specify any date string in the format "%m-%d-%Y" such as "07-22-2021".

group_by

"week" | "month" - further group time frame by week or month; NULL by default.

bar_type

"error" | "box" - if argument group_by is specified, produce either an error bar plot or box plot. Default: "error"

palette

NULL (uses ggplot2's default palette) or any categorical palette from RColorBrewer: "Set3", "Set2", "Set1", "Pastel2", "Pastel1", "Paired", "Dark2", "Accent".

Value

Either a static plot produced with ggplot2 or a dynamic one produced with plotly.


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