plot_ts: Plot time series of a country's cases

Description Usage Arguments Value Examples

View source: R/ncovr.R

Description

Plot time series of a country's cases

Usage

1
2
3
4
5
6
7
plot_ts(
  x,
  area,
  area_col = "countryEnglishName",
  date_col = "date",
  ts_col = c("confirmedCount", "curedCount", "deadCount")
)

Arguments

x

a datafram with "countryEnglishName", "date", "confirmed", "cured", "dead" columns

area

name of an selected area

area_col

the column name of the area in x

date_col

the column name of the date in x

ts_col

the column names of the time series in x

Value

a figure

Examples

1
2
3
4
5
6
7
8
9
ncov_raw <- get_ncov()
ncov_raw$area$date <- as.Date(ncovr:::conv_time(ncov_raw$area$updateTime))
x <- ncov_raw$area[, c("countryEnglishName", "countryName", "date", "confirmedCount", 
    "curedCount", "deadCount")] %>% roup_by(countryEnglishName, date) %>% 
    summarise(confirmed = sum(confirmedCount), cured = sum(curedCount), 
        dead = sum(deadCount)) %>% ungroup()
x <- x[!is.na(x$countryEnglishName) & !x$countryEnglishName == "China", 
    ]
plot_ts(x, area = "Korea")

pzhaonet/ncovr documentation built on June 12, 2020, 8:15 p.m.