plot_covid: Function to plot a location

View source: R/plotting_functions.R

plot_covidR Documentation

Function to plot a location

Description

Function returns plot of a given location. The only required input is a data frame containing covid data to be plotted. Without any other arguments, the function will look for an xvar named "Date", an outcome variable named "Confirmed", and will smooth these using a generalized additive model with natural cubic spline regression (following mgcv::gam, with bs="cs") and knots placed every 21 days, and poisson distribution assumed for the outcome These parameters can be adjusted by the user, including passing along user-defined values for xvar (for example "date"), yvar (e.g. "Deaths"), knot_interval (e.g. 7), and family (e.g. "gaussian")

Usage

plot_covid(dt, ...)

Arguments

dt

data frame containing the data

...

parameters (as above) passed on

Value

ggplot2 plot

Examples

plot_covid(brazil)
plot_covid(australia, yvar="Deaths", knot_interval=7, family="gaussian")

lmullany/rawcoviddata documentation built on March 21, 2023, 10:04 a.m.