# Import
NRX02_raw <-
statgl_url("NRX02", lang = language) %>%
statgl_fetch(
"account name" = c("LBNPTOT", "LLONTOT"),
units = "L",
time = px_all(),
.col_code = TRUE
) %>%
as_tibble()
NRX02 <-
NRX02_raw %>%
spread(`account name`, value) %>%
rename(BNP = 3, lon = 4) %>%
mutate(
value = lon / BNP,
time = time %>% as.numeric()
)
NRX02 %>%
ggplot(aes(
x = time,
y = value
)) +
geom_line(size = 2) +
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 = sdg10$figs$fig1$title[language],
x = " ",
y = " ",
caption = sdg10$figs$fig1$cap[language]
)
# Import
INXIU101_raw <-
statgl_url("INXIU101", lang = language) %>%
statgl_fetch(indicator = 0:1,
time = px_all(),
.col_code = TRUE) %>%
as_tibble()
INXIU101 <-
INXIU101_raw %>%
filter(indicator == unique(INXIU101_raw[[1]])[1]) %>%
mutate(time = time %>% make_date())
INXIU101 %>%
ggplot(aes(
x = time,
y = value
)) +
geom_line(size = 2) +
scale_color_statgl() +
theme_statgl() +
theme(legend.position = "none") +
labs(
title = unique(INXIU101_raw[[1]])[1],
subtitle = sdg10$figs$fig2$sub[language],
x = " ",
y = sdg10$figs$fig2$y_lab[language],
color = sdg10$figs$fig2$color[language],
caption = sdg10$figs$fig2$cap[language]
)
# Transform
INXIU101 <-
INXIU101_raw %>%
filter(indicator == unique(INXIU101_raw[[1]])[2]) %>%
mutate(time = time %>% make_date())
# Plot
INXIU101 %>%
ggplot(aes(
x = time,
y = value
)) +
geom_line(size = 2) +
scale_y_continuous(labels = scales::unit_format(
suffix = " ",
big.mark = ".",
decimal.mark = ","
)) +
scale_color_statgl() +
theme_statgl() +
theme(legend.position = "none") +
labs(
title = unique(INXIU101_raw[[1]])[2],
subtitle = sdg10$figs$fig3$sub[language],
x = " ",
y = sdg10$figs$fig3$y_lab[language],
caption = sdg10$figs$fig3$cap[language]
)
# NÅET HERTIL!!!
# Import
SOX004_raw <-
statgl_url("SOX004", lang = language) %>%
statgl_fetch(
"unit" = "Antal",
"type" = 10,
"time" = px_all(),
.col_code = TRUE
) %>%
as_tibble()
# Transform
SOX004 <-
SOX004_raw %>%
mutate(
time = time %>% make_date(),
value = value / 1000
)
# Plot
SOX004 %>%
ggplot(aes(
x = time,
y = value
)) +
geom_col() +
theme_statgl() +
scale_fill_statgl() +
theme(legend.position = "none") +
labs(
title = SOX004[[2]][1],
subtitle = sdg10$figs$fig4$sub[language],
x = " ",
y = sdg10$figs$fig4$y_lab[language],
fill = " ",
caption = sdg10$figs$fig4$cap[language]
)
# Import
sox010_raw <-
statgl_url("sox010", lang = language) %>%
statgl_fetch(
"no of children" = 0:4,
"no of adults" = 1:2,
"unit" = "Antal",
"type" = 10,
"time" = px_all(),
.col_code = TRUE
) %>%
as_tibble()
sox010 <-
sox010_raw %>%
mutate(time = time %>% make_date(),
`no of children` = `no of children` %>% factor(levels = unique(`no of children`) %>% rev()))
# Plot
sox010 %>%
ggplot(aes(
x = time,
y = value,
fill = `no of children`
)) +
geom_col(position = "fill") +
facet_wrap(~ `no of adults`) +
scale_y_continuous(labels = scales::percent_format(
scale = 100,
accuracy = 1,
big.mark = ".",
decimal.mark = ","
)) +
theme_statgl() +
scale_fill_statgl(reverse = TRUE, guide = guide_legend(reverse = TRUE)) +
labs(
title = sdg10$figs$fig5$title[language],
subtitle = sdg10$figs$fig5$sub[language],
x = " ",
y = " ",
fill = " ",
caption = sdg10$figs$fig5$cap[language]
)
# Import
SOXFPE1_raw <-
statgl_url("SOXFPE1", lang = language) %>%
statgl_fetch(
"unit" = "Andel",
"time" = px_all(),
.col_code = TRUE
) %>%
as_tibble()
# Transform
SOXFPE1 <-
SOXFPE1_raw %>%
mutate(time = time %>% make_date())
# Plot
SOXFPE1 %>%
ggplot(aes(
x = time,
y = value,
fill = unit
)) +
geom_col() +
scale_y_continuous(labels = scales::percent_format(
scale = 1,
accuracy = 1,
big.mark = ".",
decimal.mark = ","
)) +
theme_statgl() +
scale_fill_statgl() +
theme(legend.position = "none") +
labs(
title = sdg10$figs$fig6$title[language],
subtitle = SOXFPE1[[1]][1],
x = " ",
y = " ",
caption = sdg10$figs$fig6$cap[language]
)
# Import
SOXFPE1_raw <-
statgl_url("SOXFPE1", lang = language) %>%
statgl_fetch(
"unit" = "Andel",
"age group" = px_all(),
"time" = px_all(),
.col_code = TRUE
) %>%
as_tibble()
# Transform
SOXFPE1 <-
SOXFPE1_raw %>%
filter(`age group` %in% unique(SOXFPE1_raw[[1]])[2:6]) %>%
mutate(
`age group` = `age group` %>% factor(levels = unique(`age group`)),
time = time %>% make_date()
)
# Plot
SOXFPE1 %>%
ggplot(aes(
x = time,
y = value,
fill = `age group`
)) +
geom_col() +
facet_wrap(~ `age group`) +
theme_statgl() +
scale_fill_statgl() +
labs(
title = sdg10$figs$fig7$title[language],
subtitle = SOXFPE1[[2]][1],
x = " ",
y = " ",
fill = " ",
caption = sdg10$figs$fig7$cap[language]
)