add_daily_count_frum_cumulative: add_daily_count create a daily number of counts from a...

Description Usage Arguments Examples

View source: R/get_variant_data.R

Description

add_daily_count create a daily number of counts from a cumulative count - step 5 /5 in the "create daile counts from cumulative counts" chain

Usage

1

Arguments

...

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
data <- tribble(
  ~"date_report", ~"age", ~"sex", ~"cumulatif1", ~"cumulatif2",
  "2021-01-01", 18, "M", 10, 1,
  "2021-01-02", 18, "M", 9, 2,
  "2021-01-04", 18, "M", 12, 4,
  "2021-01-01", 19, "M", 10, 1,
  "2021-01-02", 19, "M", 9, 2,
  "2021-01-04", 19, "M", 12,4,
  "2021-01-01", 19, "F", 10,1,
  "2021-01-02", 19, "F", 9,2,
  "2021-01-04", 19, "F", 12, 4
) %>%
  mutate(date_report=as.Date(date_report))
data %>%
  fix_cumulative(., date_report, cumulatif1, age, sex) %>%   # fix first cumulatif pour assurer qu'oon a pas de baisse de cmulatif
  fix_cumulative(., date_report, cumulatif2, age, sex)  %>% # fix second cumulatif pour assurer qu'oon a pas de baisse de cmulatif
  add_slope(., date_report, cumulatif1, age, sex) %>%  # add slope for cumulatif1 for fill in missing dates
  add_slope(., date_report, cumulatif2, age, sex)  %>% # add slope for cumulatif2 for fill in missing dates
  add_missing_dates(., date_report, age, sex) %>%
  fill_cumulative_using_slope(., date_report, cumulatif1, age, sex) %>%
  fill_cumulative_using_slope(., date_report, cumulatif2, age, sex) %>%
  add_daily_count_frum_cumulative(., date_report, cumulatif1, daily1, age,sex) %>%
  add_daily_count_frum_cumulative(., date_report, cumulatif2, daily2, age,sex)

SimonCoulombe/covidtwitterbot documentation built on May 1, 2021, 6:50 a.m.