# Import
UDXISCPROD_raw <-
statgl_url("UDXISCPROD", lang = language) %>%
statgl_fetch("level of education" = 80,
gender = px_all(),
time = px_all(),
.col_code = TRUE) %>%
as_tibble()
# Transform
UDXISCPROD <-
UDXISCPROD_raw %>%
mutate(
time = time %>% make_date(),
gender = gender %>% fct_inorder()
)
# Plot
UDXISCPROD %>%
ggplot(aes(
x = time,
y = value,
fill = gender
)) +
geom_col() +
#facet_wrap(~ gender) +
theme_statgl() +
scale_fill_statgl(reverse = TRUE) +
theme(plot.margin = margin(10, 10, 10, 10)) +
labs(
title = sdg9$figs$fig1$title[language],
x = " ",
y = sdg9$figs$fig1$y_lab[language],
fill = " ",
caption = sdg9$figs$fig1$cap[language]
)
Statistikbanken # Import
ESD6A_raw <-
statgl_url("ESX6A", lang = language) %>%
statgl_fetch(
unit = "N",
time = px_all(),
"interval of aggregate salaries and shares" = c(LETTERS[1:8], "K"),
.col_code = TRUE
) %>%
as_tibble()
# transform
ESD6A <-
ESD6A_raw %>%
mutate(
`interval of aggregate salaries and shares` = `interval of aggregate salaries and shares` %>% str_remove_all("[A-K]|\\.") %>% trimws() %>% fct_inorder() %>% fct_rev(),
time = time %>% make_date()
)
# legend ...
fill_lab <- colnames(statgl_url("ESX6A", lang = language) %>% statgl_fetch() %>% as_tibble())[1] %>% str_to_sentence()
# Plot
ESD6A %>%
ggplot(aes(
x = time,
y = value,
fill = `interval of aggregate salaries and shares`
)) +
geom_area() +
theme_statgl() +
scale_fill_statgl(reverse = TRUE, guide = guide_legend(reverse = TRUE)) +
labs(
title = sdg9$figs$fig2$title[language],
subtitle = sdg9$figs$fig2$sub[language],
x = " ",
y = ESD6A[["unit"]][1],
fill = fill_lab,
caption = sdg9$figs$fig2$cap[language]
)
Statistikbanken
# Import
ESX5A_raw <-
statgl_url("ESX5A", lang = language) %>%
statgl_fetch(
municipality = 1:5,
"interval of aggregate salaries and shares" = c(LETTERS[1:8], "K"),
unit = "N",
time = px_all(),
.col_code = TRUE
) %>%
as_tibble()
ESX5A <-
ESX5A_raw %>%
rename(lonsum = `interval of aggregate salaries and shares`) %>%
mutate(
time = time %>% make_date(),
lonsum = lonsum %>% str_remove_all("[A-K]|\\.") %>% trimws() %>% fct_inorder() %>% fct_rev()
)
# Plot
ESX5A %>%
ggplot(aes(
x = time,
y = value,
fill = lonsum
)) +
geom_area() +
facet_wrap(~ municipality, scales = "free") +
theme_statgl() +
scale_fill_statgl(reverse = TRUE, guide = guide_legend(reverse = TRUE)) +
labs(
title = sdg9$figs$fig3$title[language],
subtitle = sdg9$figs$fig3$sub[language],
x = " ",
y = ESX5A[[3]][1],
fill = fill_lab,
caption = sdg9$figs$fig3$cap[language]
)
Statistikbanken # Import
IEXSITC_raw <-
statgl_url("IEXSITC", lang = language) %>%
statgl_fetch(quarter = 0,
processing = c("G11", "3"),
transaction = 2,
time = px_all(),
.col_code = TRUE
) %>%
as_tibble()
# Transform
step <-
IEXSITC_raw %>%
mutate(processing = processing %>% str_remove_all("[:digit:]|\\-") %>% trimws(which = "left")) %>%
arrange(time, processing)
IEXSITC <-
step %>%
mutate(export = fct_reorder(processing, -value, sum, na.rm = TRUE),
time = make_date(time),
value = value / 10^9)
# Plot
IEXSITC %>%
ggplot(aes(
x = time,
y = value,
fill = export
)) +
geom_area(position = "identity") +
theme_statgl() +
scale_fill_statgl(reverse = TRUE) +
labs(
title = sdg9$figs$fig4$title[language],
y = sdg9$figs$fig4$y_lab[language],
x = " ",
fill = " ",
caption = sdg9$figs$fig4$cap[language]
)
Statistikbanken # Import
IEXSITC_raw <-
statgl_url("IEXSITC", lang = language) %>%
statgl_fetch(processing = px_all(),
transaction = 2,
time = px_all(),
.col_code = TRUE
) %>%
as_tibble()
# Transform
IEXSITC <-
IEXSITC_raw %>%
filter(processing %in% unique(IEXSITC_raw[[1]])[c(16, 26, 45, 55, 65, 74)]) %>%
mutate(
time = time %>% make_date(),
value = value / 10^6,
processing = processing %>% str_remove_all("[:digit:]|\\-") %>% trimws()
)
# Plot
IEXSITC %>%
ggplot(aes(
x = time,
y = value,
fill = processing
)) +
geom_area() +
facet_wrap(~ processing, labeller = label_wrap_gen(30)) +
scale_fill_statgl() +
theme_statgl() +
theme(plot.margin = margin(10, 10, 10, 10)) +
theme(legend.position = "none") +
labs(
title = sdg9$figs$fig5$title[language],
x = " ",
y = sdg9$figs$fig5$y_lab[language],
fill = " ",
caption = sdg9$figs$fig4$cap[language]
)
Statistikbanken # Import
BVT <-
statgl_url("NRX0418", lang = language) %>%
statgl_fetch("units" = "L",
"industry" = px_all(),
"time" = px_all(),
.col_code = TRUE
) %>%
as_tibble() %>%
mutate(value = value/1000)
BVT <- BVT %>% filter(industry %in% unique(BVT %>% pull(2))[9])
BNP <-
statgl_url("NRX10", lang = language) %>%
statgl_fetch("units" = "L",
"account" = "02",
"Aar" = px_all(),
.col_code = TRUE
) %>%
as_tibble() %>%
rename("time" = Aar)
# Transform
industry <-
BVT %>%
rename("BVT" = 4) %>%
left_join(BNP %>% rename("BNP" = 4)) %>%
mutate(value = BVT / BNP,
time = time %>% as.numeric())
# Plot
industry %>%
ggplot(aes(
x = time,
y = value,
color = units
)) +
geom_line(size = 2) +
scale_y_continuous(labels = scales:: percent) +
theme_statgl() +
scale_color_statgl() +
theme(legend.position = "none") +
labs(
title = sdg9$figs$fig6$title[language],
subtitle = industry[[1]][1],
x = " ",
y = sdg9$figs$fig6$y_lab[language],
caption = sdg9$figs$fig6$cap[language]
)
Statistikbanken, bruttoværditilvækst # Import
NRX0518_raw <-
statgl_url("NRX0518", lang = language) %>%
statgl_fetch(
"units" = c("TOT", "C"),
"industry" = "BES",
"time" = px_all(),
.col_code = TRUE
) %>%
as_tibble()
NRX0518 <-
NRX0518_raw %>%
spread(units, value) %>%
rename("indu" = 3, "total" = 4) %>%
mutate(
value = indu / total,
time = time %>% as.numeric()
)
NRX0518 %>%
ggplot(aes(
x = time,
y = value,
color = industry
)) +
geom_line(size = 2) +
expand_limits(y = 0) +
scale_y_continuous(labels = scales::percent_format(scale = 100, accuracy = 1, big.mark = ".",
decimal.mark = ",")) +
theme_statgl() +
scale_color_statgl() +
theme(legend.position = "none") +
labs(
title = sdg9$figs$fig7$title[language],
x = " ",
y = sdg9$figs$fig7$y_lab[language],
caption = sdg9$figs$fig7$cap[language]
)
Statistikbanken