# 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, nrow = 2)) +
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]
)
Statistikbanken # 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, nrow = 2)) +
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]
)
Statistikbanken
# 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]
)
Statistikbanken
# 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(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]
)
Statistikbanken På grund af Covid-19 har der ikke været afholdt afgangseksamen i 2020.
# 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]
)
Statistikbanken
# 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]
)
Statistikbanken
# 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]
)
Statistikbanken
# 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]
)
Statistikbanken # Import
UDXISC11B_raw <-
statgl_url("UDXISC11B", lang = language) %>%
statgl_fetch(
"level of education" = px_all(),
.col_code = TRUE
) %>%
as_tibble()
# Transform
UDXISC11B <-
UDXISC11B_raw %>%
mutate(time = time %>% make_date(),
`level of education` = `level of education` %>% fct_inorder() %>% fct_rev(),
value = value * 10^-3)
# Plot
UDXISC11B %>%
ggplot(aes(
x = time,
y = value,
fill = `level of education`
)) +
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]
)
Statistikbanken
# Import
UDXISC11B_raw <-
statgl_url("UDXISC11B", lang = language) %>%
statgl_fetch(
country = px_all(),
.col_code = TRUE
) %>%
as_tibble()
# Translate
UDXISC11B <-
UDXISC11B_raw %>%
mutate(
time = time %>% make_date(),
country = country %>% fct_reorder(value),
value = value * 10^-3
)
# Plot
UDXISC11B %>%
ggplot(aes(
x = time,
y = value,
fill = country
)) +
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]
)
Statistikbanken
# Import
UDXISC11B_raw <-
statgl_url("UDXISC11B", lang = language) %>%
statgl_fetch(
gender = px_all(),
.col_code = TRUE
) %>%
as_tibble()
# Transform
UDXISC11B <-
UDXISC11B_raw %>%
mutate(
time = time %>% make_date(),
gender = gender %>% reorder(value),
value = value * 10^-3
)
# Plot
UDXISC11B %>%
ggplot(aes(
x = time,
y = value,
fill = gender
)) +
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]
)
Statistikbanken
# Import
UDXISC11D_raw <-
statgl_url("UDXISC11D", lang = language) %>%
statgl_fetch(
"level of education" = px_all(),
.col_code = TRUE
) %>%
as_tibble()
# Transform
UDXISC11D <-
UDXISC11D_raw %>%
mutate(
time = time %>% make_date(),
id = row_number(),
`level of education` = `level of education` %>% str_remove("uddannelse"),
`level of education` = `level of education` %>% fct_reorder(id, .fun = min, na.rm = TRUE) %>% fct_rev()
)
# Plot
UDXISC11D %>%
ggplot(aes(
x = time,
y = value,
fill = `level of education`
)) +
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]
)
Statistikbanken
# Import
UDXISC11D_raw <-
statgl_url("UDXISC11D", lang = language) %>%
statgl_fetch(
"level of education" = px_all(),
gender = px_all(),
country = c("A_SG", "B_SD"),
.col_code = TRUE
) %>%
as_tibble()
# Transform
UDXISC11D <-
UDXISC11D_raw %>%
mutate(
`level of education` = `level of education` %>% str_remove("uddannelse") %>% trimws(),
`level of education` = `level of education` %>% fct_inorder() %>% fct_rev(),
gender = gender %>% fct_inorder(),
country = country %>% fct_inorder,
time = time %>% make_date()
)
# Plot
UDXISC11D %>%
ggplot(aes(
x = time,
y = value,
fill = `level of education`
)) +
geom_col() +
facet_grid(country ~ gender,
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]
)
Statistikbanken
# Import
UDXISCPROF_raw <-
statgl_url("UDXISCPROF", lang = language) %>%
statgl_fetch(
age = "35-39",
"level of education" = c(20, 34, 35, 40, 50, 64, 65, 70, 80),
.col_code = TRUE
) %>%
as_tibble()
# Transform
UDXISCPROF <-
UDXISCPROF_raw %>%
mutate(
id = row_number(),
`level of education` = `level of education` %>% str_remove("uddannelse") %>%
fct_reorder(id, .fun = min, na.rm = T) %>% fct_rev()
)
# Plot
UDXISCPROF %>%
mutate(time = time %>% make_date()) %>%
ggplot(aes(
x = time,
y = value,
fill = `level of education`
)) +
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]
)
Statistikbanken
# Import
UDXISCPROD_raw <-
statgl_url("UDXISCPROD", lang = language) %>%
statgl_fetch(
age = "35-39",
"level of education" = c(20, 34, 35, 40, 50, 64, 65, 70, 80),
"place of residence" = px_all(),
.col_code = TRUE
) %>%
as_tibble()
# Transform
UDXISCPROD <-
UDXISCPROD_raw %>%
mutate(
id = row_number(),
`level of education` = `level of education` %>% str_remove("uddannelse") %>%
fct_reorder(id, .fun = min, na.rm = TRUE) %>% fct_rev(),
time = time %>% make_date()
)
# Plot
UDXISCPROD %>%
ggplot(aes(
x = time,
y = value,
fill = `level of education`
)) +
geom_area(position = "fill") +
facet_wrap(~ `place of residence`) +
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]
)
Statistikbanken
# Import
UDXISCPROE_raw1 <-
statgl_url("UDXISCPROE", lang = language) %>%
statgl_fetch(
"level of education" = c(35, 50, 64, 65, 70),
"fields of education" = c("06"),
.col_code = TRUE
) %>%
as_tibble()
UDXISCPROE_raw2 <-
statgl_url("UDXISCPROE", lang = language) %>%
statgl_fetch(
"level of education" = "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,
`level of education` = `level of education` %>% str_remove("uddannelse"),
time = time %>% make_date()
)
# Plot
UDXISCPROE %>%
ggplot(aes(
x = time,
y = procent,
fill = `level of education`
)) +
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]
)