query5 | R Documentation |
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.
query5( plot_type = "static", var = "new_cases", country = "United States", start = NULL, end = NULL, group_by = NULL, bar_type = "error", palette = NULL )
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". |
Either a static plot produced with ggplot2 or a dynamic one produced with plotly.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.