forked from yangclaraliu/COVID19_NPIs_vs_Rt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextract_who.R
25 lines (23 loc) · 935 Bytes
/
extract_who.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
who <- covidregionaldata::get_national_data(source = "WHO") %>%
mutate(region = countrycode(country,
origin = "country.name",
destination = "region",
nomatch = NULL)) %>%
dplyr::filter(region %in% (countrycode::codelist$region %>% unique)) %>%
filter(!is.na(region))
who %>%
group_by(date, region) %>%
summarise(value = sum(cases_new, na.rm = T)) %>%
filter(value != 0) %>%
group_by(region) %>%
mutate(rk = rank(date, ties.method = "first")) %>%
arrange(region) %>%
filter(rk == 1) %>%
arrange(region) %>%
data.frame %>%
mutate(date = if_else(region == "East Asia & Pacific",
as.Date("2020-01-01"),
date),
date = date) %>%
mutate(rk = factor(rk,
labels = c("First case\ndetected"))) -> start