View source: R/plotting_functions.R
plot_covid | R Documentation |
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")
plot_covid(dt, ...)
dt |
data frame containing the data |
... |
parameters (as above) passed on |
ggplot2 plot
plot_covid(brazil)
plot_covid(australia, yvar="Deaths", knot_interval=7, family="gaussian")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.