# Import
OFXUKN1_raw <-
statgl_url("OFXUKN1", lang = language) %>%
statgl_fetch(
keyfigures = "_3sum_ald_3_5_x",
"daycare institutions" = 1:5,
.col_code = TRUE
) %>%
as_tibble()
# Transform
OFXUKN1 <-
OFXUKN1_raw %>%
mutate(
time = time %>% make_date(),
`daycare institutions` = `daycare institutions` %>% fct_inorder()
)
# Plot
OFXUKN1 %>%
ggplot(aes(
x = time,
y = value,
fill = `daycare institutions`
)) +
geom_col() +
scale_y_continuous(labels = scales::unit_format(
suffix = " ",
big.mark = ".",
decimal.mark = ","
)) +
theme_statgl() +
scale_fill_statgl(reverse = TRUE, guide = guide_legend(reverse = FALSE)) +
labs(
title = sdg4$figs$fig1$title[language],
subtitle = OFXUKN1[[2]][1],
x = " ",
y = sdg4$figs$fig1$y_lab[language],
fill = " ",
caption = sdg4$figs$fig1$cap[language]
)
# Import
OFXUKN1_raw <-
statgl_url("OFXUKN1", lang = language) %>%
statgl_fetch(
keyfigures = "_3sum_ald_3_5_x",
"daycare institutions" = 1:5,
residence = c("By", "Bygd"),
.col_code = TRUE
) %>%
as_tibble()
# Transform
OFXUKN1 <-
OFXUKN1_raw %>%
mutate(
`daycare institutions` = `daycare institutions` %>% fct_inorder(),
residence = residence %>% fct_inorder(),
time = time %>% make_date(),
)
# Plot
OFXUKN1 %>%
ggplot(aes(
x = time,
y = value,
fill = `daycare institutions`
)) +
geom_col() +
facet_wrap(~ residence, scales = "free_y") +
theme_statgl() +
scale_fill_statgl(reverse = TRUE, guide = guide_legend(reverse = FALSE)) +
labs(
title = sdg4$figs$fig2$title[language],
subtitle = OFXUKN1[[3]][1],
x = " ",
y = sdg4$figs$fig2$y_lab[language],
fill = NULL,
caption = sdg4$figs$fig2$cap[language]
)
# Import
UDXTKB_raw <-
statgl_url("UDXTKB", lang = language) %>%
statgl_fetch(
subject = px_all(),
grade = c(3, 7),
unit = "B",
.col_code = TRUE) %>%
as_tibble()
# Transform
UDXTKB <-
UDXTKB_raw %>%
mutate(
time = time %>% make_date(),
subject = subject %>% fct_inorder()
)
# Plot
UDXTKB %>%
ggplot(aes(
x = time,
y = value,
color = subject
)) +
geom_line(size = 2) +
facet_wrap(~ grade) +
scale_y_continuous(labels = scales::percent_format(
scale = 1,
accuracy = 1,
big.mark = ".",
decimal.mark = ","
)) +
theme_statgl() +
scale_color_statgl() +
labs(
title = sdg4$figs$fig3$title[language],
subtitle = UDXTKB[[3]][1],
x = " ",
y = " ",
color = sdg4$figs$fig3$color[language],
caption = sdg4$figs$fig3$cap[language]
)
# Import
UDXTKB_raw <-
statgl_url("UDXTKB", lang = language) %>%
statgl_fetch(
subject = px_all(),
grade = c(3, 7),
unit = "B",
"place of residence" = 1:2,
.col_code = TRUE
) %>%
as_tibble()
# Transform
UDXTKB <-
UDXTKB_raw %>%
mutate(
time = time %>% make_date(),
`place of residence` = `place of residence` %>% fct_inorder(),
subject = subject %>% fct_inorder()
)
# Plot
UDXTKB %>%
ggplot(aes(
x = time,
y = value,
color = subject
)) +
geom_line(size = 2) +
facet_grid(grade ~ `place of residence`) +
scale_y_continuous(labels = scales::percent_format(
scale = 1,
accuracy = 1,
big.mark = ".",
decimal.mark = ","
)) +
theme_statgl() +
scale_color_statgl() +
labs(
title = sdg4$figs$figX$title_fig4,
subtitle = UDXTKB[[4]][1],
x = " ",
y = " ",
color = sdg4$figs$fig4$color[language],
caption = sdg4$figs$fig4$cap[language]
)
# Import
UDXFKK_raw <-
statgl_url("UDXFKK", lang = language) %>%
statgl_fetch(
unit = "Avg",
grade = "FO",
subject = c("01", "02", "03", "04"),
"type of grades" = 56:58,
.col_code = TRUE
) %>%
as_tibble()
# Transform
UDXFKK <-
UDXFKK_raw %>%
mutate(
`type of grades` = `type of grades` %>% str_remove_all("Prøvekarakter -") %>% trimws() %>% str_to_title(),
subject = subject %>% fct_inorder(),
time = time %>% make_date()
)
# Plot
UDXFKK %>%
ggplot(aes(
x = time,
y = value,
color = `type of grades`
)) +
geom_line(size = 2) +
facet_wrap( ~ subject, ncol = 2) +
theme_statgl() +
scale_color_statgl() +
labs(
title = sdg4$figs$fig5$title[language],
color = sdg4$figs$fig5$color[language],
x = " ",
y = sdg4$figs$fig5$y_lab[language],
caption = sdg4$figs$fig5$cap[language]
)
# Import
UDXTRFA1_raw <-
statgl_url("UDXTRFA1", lang = language) %>%
statgl_fetch(
"number of years after lower secondary education" = 2,
"educational status" = px_all(),
"graduation year" = px_all(),
.col_code = TRUE
) %>%
as_tibble()
# Transform
UDXTRFA1 <-
UDXTRFA1_raw %>%
filter(`graduation year` <= year(Sys.time()) - 3) %>%
mutate(`graduation year` = `graduation year` %>% make_date())
# Plot
UDXTRFA1 %>%
ggplot(aes(
x = `graduation year`,
y = value,
fill = `educational status`
)) +
geom_col(position = "fill") +
scale_y_continuous(labels = scales::percent_format(
scale = 100,
accuracy = 1,
big.mark = ".",
decimal.mark = ","
)) +
scale_fill_statgl(reverse = TRUE) +
theme_statgl() +
labs(
title = sdg4$figs$fig6$title[language],
subtitle = sdg4$figs$fig6$sub[language],
x = sdg4$figs$fig6$x_lab[language],
y = " ",
fill = sdg4$figs$fig6$fill[language],
caption = sdg4$figs$fig6$cap[language]
)
# Import
UDXTRFA1_raw <-
statgl_url("UDXTRFA1", lang = language) %>%
statgl_fetch(
"number of years after lower secondary education" = 2,
"educational status" = px_all(),
"graduation year" = px_all(),
gender = px_all(),
.col_code = TRUE
) %>%
as_tibble()
# Transform
UDXTRFA1 <-
UDXTRFA1_raw %>%
filter(`graduation year` <= year(Sys.time())-3) %>%
mutate(`graduation year` = `graduation year` %>% make_date())
# Plot
UDXTRFA1 %>%
ggplot(aes(
x = `graduation year`,
y = value,
fill = `educational status`
)) +
geom_col(position = "fill") +
facet_wrap(~ gender) +
scale_y_continuous(labels = scales::percent_format()) +
scale_fill_statgl(reverse = TRUE) +
theme_statgl() +
labs(
title = sdg4$figs$fig7$title[language],
subtitle = sdg4$figs$fig7$sub[language],
x = sdg4$figs$fig7$x_lab[language],
y = " ",
fill = sdg4$figs$fig7$fill[language],
caption = sdg4$figs$fig7$cap[language]
)
# Import
UDXTRGU2_raw <-
statgl_url("UDXTRGU2", lang = language) %>%
statgl_fetch(
"number of years after graduation" = 2,
"educational status" = px_all(),
"graduation year" = px_all(),
.col_code = TRUE) %>%
as_tibble()
# Transform
UDXTRGU2 <-
UDXTRGU2_raw %>%
mutate(`graduation year` = `graduation year` %>% make_date())
# Plot
UDXTRGU2 %>%
ggplot(aes(
x = `graduation year`,
y = value,
fill = `educational status`
)) +
geom_col(position = "fill") +
scale_y_continuous(labels = scales::percent_format(
scale = 100,
accuracy = 1,
big.mark = ".",
decimal.mark = ","
)) +
theme_statgl() +
scale_fill_statgl(reverse = TRUE) +
labs(
title = sdg4$figs$fig8$title[language],
subtitle = sdg4$figs$fig8$sub[language],
x = sdg4$figs$fig8$x_lab[language],
y = " ",
fill = sdg4$figs$fig8$fill[language],
caption = sdg4$figs$fig8$cap[language]
)
# Import
UDXTRGU2_raw <-
statgl_url("UDXTRGU2", lang = language) %>%
statgl_fetch(
"number of years after graduation" = 2,
"educational status" = px_all(),
"graduation year" = px_all(),
gender = px_all(),
.col_code = TRUE
) %>%
as_tibble()
# Transform
UDXTRGU2 <-
UDXTRGU2_raw %>%
mutate(`graduation year` = `graduation year` %>% make_date())
# Plot
UDXTRGU2 %>%
ggplot(aes(
x = `graduation year`,
y = value,
fill = `educational status`
)) +
geom_col(position = "fill") +
facet_wrap( ~ gender) +
scale_y_continuous(labels = scales::percent_format(
scale = 100,
accuracy = 1,
big.mark = ".",
decimal.mark = ","
)) +
theme_statgl() +
scale_fill_statgl(reverse = TRUE) +
labs(
title = sdg4$figs$fig9$title[language],
subtitle = sdg4$figs$fig9$sub[language],
x = sdg4$figs$fig9$x_lab[language],
y = " ",
fill = sdg4$figs$fig9$fill[language],
caption = sdg4$figs$fig9$cap[language]
)