1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
- knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE)
- pacman::p_load(tidyverse, tsibble, fable, plotly, urca, feasts, readxl, lubridate,
- janitor, scales, lemon, gghighlight, ggrepel, patchwork, extrafont,
- RColorBrewer, glue, Metrics, directlabels, WDI, eurostat,
- update = FALSE, install = FALSE)
- stmf_data <- read_csv("https://www.mortality.org/Public/STMF/Outputs/stmf.csv", skip = 2) %>%
- rename_all(tolower)
- knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE)
- pacman::p_load(tidyverse, tsibble, fable, plotly, urca, feasts, readxl, lubridate,
- janitor, scales, lemon, gghighlight, ggrepel, patchwork, extrafont,
- RColorBrewer, glue, Metrics, directlabels, WDI, eurostat,
- update = FALSE, install = FALSE)
- stmf_data <- read_csv("https://www.mortality.org/Public/STMF/Outputs/stmf.csv", skip = 2) %>%
- rename_all(tolower)
- nrow(stmf_data)
- stmf_country_codes <- read_excel("data/hmd_stmf_country_codes.xlsx")
- stmf_country_codes <- read_excel("data/hmd_stmf_country_codes.xlsx")
- head(search_eurostat("Deaths by week and sex"))
- eurostat_data <- get_eurostat("demo_r_mwk_ts", time_format = "raw")
- eurostat_data <- label_eurostat(eurostat_data, custom_dic = c(DE = "Germany",
- UK = "The United Kingdom"))
- eurostat_data <- eurostat_data %>%
- rename(country_name = geo,
- value = values) %>%
- mutate(year = str_sub(time,1,4),
- year = as.integer(year),
- week = str_sub(time,6,7),
- week = as.integer(week),
- dtotal = value) %>%
- filter(sex == "Total") %>%
- filter(week != 99) %>%
- filter(year >= 2015) %>%
- arrange(country_name, year, week) %>%
- select(country_name, year, week, dtotal) %>%
- rename(time = week, deaths = dtotal) %>%
- mutate(time_unit = "weekly",
- source = "EuroStat") %>%
- filter(country_name != "Andora")
- eurostat_data
- eurostat_data %>% tabyl(country_name)
- knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE)
- pacman::p_load(tidyverse, tsibble, fable, plotly, urca, feasts, readxl, lubridate,
- janitor, scales, lemon, gghighlight, ggrepel, patchwork, extrafont,
- RColorBrewer, glue, Metrics, directlabels, WDI, eurostat,
- update = FALSE, install = FALSE)
- stmf_data <- read_csv("https://www.mortality.org/Public/STMF/Outputs/stmf.csv", skip = 2) %>%
- rename_all(tolower)
|