# Import
OFXUKN1_raw <-
statgl_url("OFXUKN1", lang = language) %>%
statgl_fetch(
born_var = 3:5,
inst_type2 = 1:5,
.col_code = TRUE
) %>%
as_tibble()
# Transform
OFXUKN1 <-
OFXUKN1_raw %>%
mutate(across(where(is.integer), ~ if_else(is.na(.x), 0, .x))) |>
summarise(value = sum(value), .by = c(inst_type2, aar)) |>
mutate(
aar = aar %>% make_date(),
inst_type2 = inst_type2 %>% fct_inorder(),
alder = "Børn 3-5 år"
)
# Plot
OFXUKN1 %>%
ggplot(aes(
x = aar,
y = value,
fill = inst_type2
)) +
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, nrow = 2)) +
labs(
title = sdg4$figs$fig1$title[language],
subtitle = OFXUKN1[[4]][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(
born_var = 3:5,
inst_type2 = 1:5,
bosted = 1:2,
.col_code = TRUE
) %>%
as_tibble()
# Transform
OFXUKN1 <-
OFXUKN1_raw %>%
mutate(
inst_type2 = inst_type2 %>% fct_inorder(),
bosted = bosted %>% fct_inorder(),
aar = aar %>% make_date(),
born_var = "Børn 3-5 år",
across(where(is.integer), ~ if_else(is.na(.x), 0, .x))
) |>
summarise(value = sum(value), .by = c(inst_type2, born_var, bosted, aar))
# Plot
OFXUKN1 %>%
ggplot(aes(
x = aar,
y = value,
fill = inst_type2
)) +
geom_col() +
facet_wrap(~ bosted, scales = "free_y") +
theme_statgl() +
scale_fill_statgl(reverse = TRUE, guide = guide_legend(reverse = FALSE, nrow = 2)) +
labs(
title = sdg4$figs$fig2$title[language],
subtitle = OFXUKN1[[2]][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 = "andel",
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(guide = guide_legend(nrow = 3)) +
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]
)
Due to Covid-19 there has not been held final exams in 2020.
# Import
UDXTRFA1_raw <-
statgl_url("UDXTRFA1", lang = language) %>%
statgl_fetch(
aar = 2,
status = px_all(),
dim_aar = px_all(),
.col_code = TRUE
) %>%
as_tibble()
# Transform
UDXTRFA1 <-
UDXTRFA1_raw %>%
filter(dim_aar <= year(Sys.time()) - 3) %>%
mutate(dim_aar = dim_aar %>% make_date())
# Plot
UDXTRFA1 %>%
ggplot(aes(
x = dim_aar,
y = value,
fill = 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(
aar = 2,
status = px_all(),
dim_aar = px_all(),
sex = px_all(),
.col_code = TRUE
) %>%
as_tibble()
# Transform
UDXTRFA1 <-
UDXTRFA1_raw %>%
filter(dim_aar <= year(Sys.time()) - 3) %>%
mutate(dim_aar = dim_aar %>% make_date())
# Plot
UDXTRFA1 %>%
ggplot(aes(
x = dim_aar,
y = value,
fill = status
)) +
geom_col(position = "fill") +
facet_wrap(~ sex) +
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 %>%
filter(`graduation year` <= year(Sys.time()) - 3) |>
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 %>%
filter(`graduation year` <= year(Sys.time()) - 3) |>
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]
)
# Import
UDXISC11B_raw <-
statgl_url("UDXISC11B", lang = language) %>%
statgl_fetch(
isced = px_all(),
.col_code = TRUE
) %>%
as_tibble()
# Transform
UDXISC11B <-
UDXISC11B_raw %>%
mutate(taar = taar %>% make_date(),
isced = isced %>% fct_inorder() %>% fct_rev(),
value = value * 10^-3)
# Plot
UDXISC11B %>%
ggplot(aes(
x = taar,
y = value,
fill = isced
)) +
geom_col() +
guides(fill = guide_legend(nrow = 4, byrow = TRUE)) +
theme_statgl() +
scale_fill_statgl(reverse = TRUE, guide = guide_legend(reverse = FALSE)) +
labs(
title = sdg4$figs$fig10$title[language],
x = " ",
y = sdg4$figs$fig10$y_lab[language],
fill = NULL,
caption = sdg4$figs$fig10$cap[language]
)
# Import
UDXISC11B_raw <-
statgl_url("UDXISC11B", lang = language) %>%
statgl_fetch(
skoleomr = px_all(),
.col_code = TRUE
) %>%
as_tibble()
# Translate
UDXISC11B <-
UDXISC11B_raw %>%
mutate(
taar = taar %>% make_date(),
skoleomr = skoleomr %>% fct_reorder(value),
value = value * 10^-3
)
# Plot
UDXISC11B %>%
ggplot(aes(
x = taar,
y = value,
fill = skoleomr
)) +
geom_col() +
theme_statgl() +
scale_fill_statgl(reverse = TRUE, guide = guide_legend(reverse = TRUE)) +
labs(
title = sdg4$figs$fig11$title[language],
x = " ",
y = sdg4$figs$fig11$y_lab[language],
fill = " ",
caption = sdg4$figs$fig11$cap[language]
)
# Import
UDXISC11B_raw <-
statgl_url("UDXISC11B", lang = language) %>%
statgl_fetch(
sex = px_all(),
.col_code = TRUE
) %>%
as_tibble()
# Transform
UDXISC11B <-
UDXISC11B_raw %>%
mutate(
taar = taar %>% make_date(),
sex = sex %>% reorder(value),
value = value * 10^-3
)
# Plot
UDXISC11B %>%
ggplot(aes(
x = taar,
y = value,
fill = sex
)) +
geom_col() +
theme_statgl() +
scale_fill_statgl() +
labs(
title = sdg4$figs$fig12$title[language],
x = " ",
y = sdg4$figs$fig12$y_lab[language],
fill = " ",
caption = sdg4$figs$fig12$cap[language]
)
# Import
UDXISC11D_raw <-
statgl_url("UDXISC11D", lang = language) %>%
statgl_fetch(
Isced = px_all(),
.col_code = TRUE
) %>%
as_tibble()
# Transform
UDXISC11D <-
UDXISC11D_raw %>%
mutate(
slutaar = slutaar %>% make_date(),
id = row_number(),
Isced = Isced %>% str_remove("uddannelse"),
Isced = Isced %>% fct_reorder(id, .fun = min, na.rm = TRUE) %>% fct_rev()
)
# Plot
UDXISC11D %>%
ggplot(aes(
x = slutaar,
y = value,
fill = Isced
)) +
geom_col() +
scale_y_continuous(labels = scales::number_format(
accuracy = 1,
big.mark = ".",
decimal.mark = ",")) +
theme_statgl() +
scale_fill_statgl(reverse = TRUE, guide = guide_legend(reverse = TRUE, nrow = 4)) +
labs(
title = sdg4$figs$fig13$title[language],
subtitle = sdg4$figs$fig13$sub[language],
x = " ",
y = sdg4$figs$fig13$y_lab[language],
fill = sdg4$figs$fig13$fill[language],
caption = sdg4$figs$fig13$cap[language]
)
# Import
UDXISC11D_raw <-
statgl_url("UDXISC11D", lang = language) %>%
statgl_fetch(
Isced = px_all(),
sex = px_all(),
skoleomr = c("A_SG", "B_SD"),
.col_code = TRUE
) %>%
as_tibble()
# Transform
UDXISC11D <-
UDXISC11D_raw %>%
mutate(
Isced = Isced %>% str_remove("uddannelse") %>% trimws(),
Isced = Isced %>% fct_inorder() %>% fct_rev(),
sex = sex %>% fct_inorder(),
skoleomr = skoleomr %>% fct_inorder,
slutaar = slutaar %>% make_date()
)
# Plot
UDXISC11D %>%
ggplot(aes(
x = slutaar,
y = value,
fill = Isced
)) +
geom_col() +
facet_grid(skoleomr ~ sex,
scales = "free_y") +
scale_y_continuous(labels = scales::number_format(
accuracy = 1,
big.mark = ".",
decimal.mark = ","
)) +
theme_statgl() +
scale_fill_statgl(reverse = TRUE,
guide = guide_legend(reverse = TRUE, nrow = 4)) +
labs(
title = sdg4$figs$fig14$title[language],
subtitle = sdg4$figs$fig14$sub[language],
x = " ",
y = sdg4$figs$fig14$y_lab[language],
fill = sdg4$figs$fig14$fill[language],
caption = sdg4$figs$fig14$cap[language]
)
# Import
UDXISCPROF_raw <-
statgl_url("UDXISCPROF", lang = language) %>%
statgl_fetch(
alder_grp = "35-39",
ISCED11_level = c(20, 34, 35, 40, 50, 64, 65, 70, 80),
.col_code = TRUE
) %>%
as_tibble()
# Transform
UDXISCPROF <-
UDXISCPROF_raw %>%
mutate(
id = row_number(),
ISCED11_level = ISCED11_level %>% str_remove("uddannelse") %>%
fct_reorder(id, .fun = min, na.rm = T) %>% fct_rev()
)
# Plot
UDXISCPROF %>%
mutate(Aar = Aar %>% make_date()) %>%
ggplot(aes(
x = Aar,
y = value,
fill = ISCED11_level
)) +
geom_area(position = "fill") +
scale_y_continuous(labels = scales::percent_format(
scale = 100,
accuracy = 1,
big.mark = ".",
decimal.mark = ","
)) +
theme_statgl(base_size = 11) +
guides(fill = guide_legend(nrow = 3, byrow = TRUE)) +
scale_fill_statgl(reverse = TRUE, guide = guide_legend(reverse = TRUE)) +
labs(
title = sdg4$figs$fig15$title[language],
subtitle = UDXISCPROF[[2]][1],
x = " ",
y = " ",
fill = NULL,
caption = sdg4$figs$fig15$cap[language]
)
# Import
UDXISCPROD_raw <-
statgl_url("UDXISCPROD", lang = language) %>%
statgl_fetch(
alder_grp = "35-39",
ISCED11_level = c(20, 34, 35, 40, 50, 64, 65, 70, 80),
Bsted = px_all(),
.col_code = TRUE
) %>%
as_tibble()
# Transform
UDXISCPROD <-
UDXISCPROD_raw %>%
mutate(
id = row_number(),
ISCED11_level = ISCED11_level %>% str_remove("uddannelse") %>%
fct_reorder(id, .fun = min, na.rm = TRUE) %>% fct_rev(),
Aar = Aar %>% make_date()
)
# Plot
UDXISCPROD %>%
ggplot(aes(
x = Aar,
y = value,
fill = ISCED11_level
)) +
geom_area(position = "fill") +
facet_wrap(~ Bsted) +
scale_y_continuous(labels = scales::percent_format(
scale = 100,
accuracy = 1,
big.mark = ".",
decimal.mark = ","
)) +
theme_statgl(base_size = 11) +
guides(fill = guide_legend(nrow = 3, byrow = TRUE)) +
scale_fill_statgl(reverse = TRUE, guide = guide_legend(reverse = TRUE)) +
labs(
title = sdg4$figs$fig16$title[language],
subtitle = UDXISCPROD[[3]][1],
x = " ",
y = " ",
fill = NULL,
caption = sdg4$figs$fig16$cap[language]
)
# Import
UDXISCPROE_raw1 <-
statgl_url("UDXISCPROE", lang = language) %>%
statgl_fetch(
ISCED11_level = c(35, 50, 64, 65, 70),
ISCED11_sektor = c("06"),
.col_code = TRUE
) %>%
as_tibble()
UDXISCPROE_raw2 <-
statgl_url("UDXISCPROE", lang = language) %>%
statgl_fetch(
ISCED11_level = "00",
.col_code = TRUE
) %>%
as_tibble()
# Transform
UDXISCPROE <-
UDXISCPROE_raw1 %>%
rename(tæller = value) %>%
left_join(UDXISCPROE_raw2 %>% rename(nævner = value) %>% select(-1)) %>%
mutate(
procent = tæller / nævner * 100,
ISCED11_level = ISCED11_level %>% str_remove("uddannelse"),
Aar = Aar %>% make_date()
)
# Plot
UDXISCPROE %>%
ggplot(aes(
x = Aar,
y = procent,
fill = ISCED11_level
)) +
geom_col() +
scale_y_continuous(labels = scales::percent_format(
scale = 1,
big.mark = ".",
decimal.mark = ","
)) +
theme_statgl() +
scale_fill_statgl(reverse = TRUE, palette = "spring") +
guides(fill = guide_legend(nrow = 2, byrow = TRUE)) +
labs(
title = sdg4$figs$fig17$title[language],
subtitle = sdg4$figs$fig17$sub[language],
x = " ",
y = " ",
fill = NULL,
caption = sdg4$figs$fig17$cap[language]
)