plotTimeSeries: Create Time-Series Plots

Description Usage Arguments Examples

View source: R/silasDataViz.R

Description

Visualize disease statistics on a day-by-day basis

Usage

1
2
plotTimeSeries(data, plot_what = "cases", group = "all",
  x_axis = "date")

Arguments

data

disease data to plot (usually the output of filterDiseaseData)

plot_what

options are: "cases" (default), "recovered", "deaths" (plots totals by date), "log_cases", "log_recovered", "log_deaths" (plots natural log of totals by date), "x_per_y" where x and y are either "cases", "recovered", "deaths", or "pop" (plots the ratio by date), "new_cases", "new_recovered", "new_deaths" (plots change by date) or "growth_factor" (plots new cases divided by new cases on previous date for each date)

group

options are: "province", "region", or "all" ("all" is the default). "province" creates one plot layer for each province in the data, "region" creates one plot layer for each region in the data, "all" creates one plot layer total

x_axis

options are "date" ("date" is the default) or "day_of_disease". "date" makes the x-axis the calendar date, "day_of_disease" makes the x-axis the days since the 100th case in the group (where group is specified in the group argument)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
covid_data <- importCovidData()
us_covid_data <- filterDiseaseData(covid_data, country = "US")
us_italy_covid_data <- filterDiseaseData(covid_data, country = c("US", "Italy"))
plotTimeSeries(us_covid_data, plot_what = "cases")  # will plot US cases
plotTimeSeries(us_italy_covid_data, group = "all")  # will plot aggregate US & Italy cases
plotTimeSeries(us_italy_covid_data,plot_what="log_cases",group="region",x_axis="day_of_disease")   
# will have one layer for log of US cases, another for log of Italy cases

plotTimeSeries(us_covid_data, plot_what = "deaths_per_cases")
plotTimeSeries(us_covid_data, plot_what = "new_deaths")

smorsink1/ncov2019 documentation built on March 27, 2020, 7:22 p.m.