plot_metric: Plot a line chart using ggplot

Description Usage Arguments Value Examples

View source: R/plot_metric.R

Description

Plot a line chart using ggplot

Usage

1
2
3
4
5
6
7
8
9
plot_metric(
  df,
  loc_val = "Canada",
  metric = "positive_rate",
  date_from = NULL,
  date_to = NULL,
  location = NULL,
  new_cases = NULL
)

Arguments

df

Data frame of the selected COVID data from get_data()

loc_val

A character vector of target country name. By default c('Canada)

metric

A character vector with, at most, one element.

date_from

A character vector having the starting date, one element.

date_to

A character vector having the end date, one element.

location

A character vector containing the locations around the world

new_cases

A character vector containing aggregated total new COVID cases

Value

A ggplot line chart

Examples

1
2
3
4
data <- get_data(date_from = "2022-01-01", date_to = "2022-01-07")
loc <- c("Canada")
x <- "positive_rate"
plot_metric(df = data, loc_val = loc, metric = x, date_from = "2022-01-01", "2022-01-15")

UBC-MDS/covizr documentation built on Feb. 7, 2022, 9:11 a.m.