Tilbage


Delmål 3: Sundhed og trivsel

Aborter


GS Aldersstandardiseret rate hos kvinder i alderen 12-49 år
# Helper function:
age_adjust <- function(count, pop, rate = NULL, stdpop){
  if (missing(count) & !missing(pop) & is.null(rate)) {
    count <- rate * pop
  }
  
  if (missing(pop) & !missing(count) & is.null(rate)) {
    pop <- count/rate
    pop[!is.finite(pop)] <- 0
  }
  
  if (is.null(rate) & !missing(count) & !missing(pop)){
    rate <- count/pop
    rate[!is.finite(rate)] <- 0
  }

  cruderate <- sum(count)/sum(pop)
  stdwt <- stdpop/sum(stdpop)
  dsr <- sum(stdwt * rate)
  
  tibble(`crude_rate` = cruderate, `std_rate` = dsr)
}

# Import
SUDA2_raw <- 
  statgl_url("SUXA2", lang = "da") %>% 
  statgl_fetch(.eliminate_rest = FALSE) %>% 
  as_tibble() %>% 
    rename(Aborter = value)

# Tidy
SUDA_2 <- SUDA2_raw %>% 
  as_tibble() %>% 
  spread(enhed, Aborter) %>% 
  mutate_at(c(1, 2), strtoi)

# Standardize
SUDA_2_2000 <- SUDA_2 %>% filter(tid == 2000) %>% pull(Middelfolketal)

SUDA2_std <- SUDA_2 %>% 
  group_by(tid) %>% 
  summarise(age_adjust(Aborter, Middelfolketal, stdpop = SUDA_2_2000) * 1000)

# Plot
SUDA2_std %>% 
  ggplot(aes(x = tid, y = std_rate)) +
  geom_line(size = 2, color = statgl:::statgl_cols("darkblue"))+
  theme_statgl() +
  theme(plot.margin = margin(10, 10, 10, 10)) +
  labs(title = "Aborter", x = "Tid", y = "Aborter pr. 1000 kvinder i alderen 12-49 år\n(Aldersstandardiseret)", 
       subtitle = "Aldersstandardiseret - Baseår 2000")

Statistikbanken


# Helper function:
age_adjust <- function(count, pop, rate = NULL, stdpop){
  if (missing(count) & !missing(pop) & is.null(rate)) {
    count <- rate * pop
  }
  
  if (missing(pop) & !missing(count) & is.null(rate)) {
    pop <- count/rate
    pop[!is.finite(pop)] <- 0
  }
  
  if (is.null(rate) & !missing(count) & !missing(pop)){
    rate <- count/pop
    rate[!is.finite(rate)] <- 0
  }

  
  cruderate <- sum(count)/sum(pop)
  stdwt <- stdpop/sum(stdpop)
  dsr <- sum(stdwt * rate)
  
  tibble(`crude_rate` = cruderate, `std_rate` = dsr)
}

# Import
SUDA2_raw <- 
  statgl_url("SUXA2", lang = "da") %>% 
  statgl_fetch(.eliminate_rest = FALSE) %>% 
  as_tibble() %>% 
  rename(Aborter = value)

# Tidy
SUDA_2 <- SUDA2_raw %>% 
  as_tibble() %>% 
  spread(enhed, Aborter) %>% 
  mutate_at(c(1, 2), strtoi)

# Standardize
SUDA_2_2000 <- SUDA_2 %>% filter(tid == 2000) %>% pull(Middelfolketal)

SUDA2_std <- SUDA_2 %>% 
  group_by(tid) %>% 
  summarise(age_adjust(Aborter, Middelfolketal, stdpop = SUDA_2_2000) * 1000,
            Aborter = sum(Aborter), Middelfolketal = sum(Middelfolketal))

# Table
SUDA2_std %>% select(tid, Aborter, Middelfolketal, everything()) %>% 
  rename(`Aborter pr. 1000` = crude_rate, `Aldersstandardiseret rate pr. 1000 kvinder, 12-49 år` = std_rate, Tid = tid) %>% 
  mutate_at(4:5, format, digits = 3, decimal.mark = ",") %>% 
  statgl_table(year_col = "Tid")
Tid Aborter Middelfolketal Aborter pr. 1000 Aldersstandardiseret rate pr. 1000 kvinder, 12-49 år
1993 979 15.432 63,4 56,1
1994 1.002 15.477 64,7 57,5
1995 880 15.473 56,9 50,6
1996 862 15.433 55,9 52,2
1997 843 15.464 54,5 51,3
1998 915 15.497 59,0 56,9
1999 840 15.531 54,1 53,2
2000 944 15.609 60,5 60,5
2001 814 15.718 51,8 52,5
2002 822 15.816 52,0 52,8
2003 869 15.889 54,7 55,9
2004 905 16.002 56,6 58,1
2005 899 16.090 55,9 57,1
2006 904 16.036 56,4 55,7
2007 887 15.926 55,7 54,8
2008 899 15.774 57,0 55,1
2009 799 15.694 50,9 48,2
2010 858 15.689 54,7 51,9
2011 743 15.594 47,6 43,9
2012 784 15.379 51,0 46,1
2013 875 15.139 57,8 52,0
2014 864 14.910 57,9 52,9
2015 864 14.626 59,1 53,1
2016 855 14.364 59,5 52,4
2017 883 14.169 62,3 54,5
2018 931 14.019 66,4 57,9
2019 902 13.941 64,7 56,2

Middellevetid


GS Middellevetid for 0 og 1 - årige personer født i Grønland
# Import
BEXDT5A_raw <-
  statgl_url("BEXDT5A", lang = "da") %>% 
  statgl_fetch(type = "E",
               age = c(0, 1),
               .col_code = TRUE) %>% 
  as_tibble()

# Transform
BEXDT5A <- 
  BEXDT5A_raw %>% 
  separate(time, into = c("startaar", "slutaar"), sep = " - ") %>% 
  mutate(slutaar = slutaar %>% as.numeric %>% make_date()) %>% 
  select(-3)

# Plot
BEXDT5A %>% 
  ggplot(aes(x = slutaar, y = value, color = age)) +
  geom_line(size = 2) +
    scale_y_continuous(labels = scales::unit_format(
    suffix = " ",
    big.mark = ".",
    decimal.mark = ","
  )) +
  theme_statgl() + scale_color_statgl() +
  labs(
    title = "Middellevetid for 0 og 1-årige",
    subtitle = "Personer født i Grønland",
    x = "Tid (5-års-intervaller)",
    y = "Middellevetid",
    color = "Alder",
    caption = "Kilde: https://bank.stat.gl/BEDDT5A"
  )

Statistikbanken

Metode


# Table
BEXDT5A_raw %>% 
  spread(2, 4) %>% 
  select(-1) %>% 
  rename(c(" " = 1)) %>% 
  statgl_table() %>% 
  add_footnote("Middellevetid for 0 og 1-årige, personer født i Grønland.", 
               notation = "symbol") %>%
  scroll_box(height = "500px")
0 1
1977 - 1981 63,71 64,64
1978 - 1982 63,35 64,40
1979 - 1983 62,78 63,93
1980 - 1984 62,89 64,01
1981 - 1985 62,89 63,94
1982 - 1986 62,79 63,75
1983 - 1987 62,93 63,76
1984 - 1988 63,33 63,92
1985 - 1989 63,65 64,13
1986 - 1990 63,65 64,25
1987 - 1991 63,68 64,44
1988 - 1992 64,07 64,66
1989 - 1993 64,22 64,92
1990 - 1994 64,32 65,04
1991 - 1995 64,54 65,09
1992 - 1996 64,92 65,32
1993 - 1997 64,73 65,21
1994 - 1998 64,74 65,12
1995 - 1999 64,74 65,05
1996 - 2000 65,13 65,42
1997 - 2001 65,26 65,41
1998 - 2002 65,77 65,88
1999 - 2003 66,41 66,37
2000 - 2004 66,84 66,76
2001 - 2005 67,12 66,91
2002 - 2006 67,56 67,41
2003 - 2007 67,95 67,75
2004 - 2008 68,20 68,02
2005 - 2009 68,78 68,47
2006 - 2010 68,90 68,58
2007 - 2011 69,10 68,72
2008 - 2012 69,40 69,02
2009 - 2013 69,60 69,17
2010 - 2014 69,80 69,40
2011 - 2015 70,40 70,02
2012 - 2016 70,60 70,25
2013 - 2017 70,63 70,22
2014 - 2018 70,70 70,27
2015 - 2019 70,46 70,09
* Middellevetid for 0 og 1-årige, personer født i Grønland.
# Import
BEXDT5A_raw <-
  statgl_url("BEXDT5A", lang = "da") %>%
  statgl_fetch(type = "E",
               age = c(0, 1),
               residence = 1:2,
               .col_code = TRUE) %>% 
  as_tibble()

# Transform
BEXDT5A <- 
  BEXDT5A_raw %>% 
  separate(time, into = c("startaar", "slutaar"), sep = " - ") %>% 
  mutate(slutaar = as.numeric(slutaar) %>% make_date()) %>% 
  select(-4)

# Plot
BEXDT5A %>% 
  ggplot(aes(
    x = slutaar,
    y = value,
     color = age
  )) +
  geom_line(size = 2) +
  facet_wrap(~ residence) +
  scale_y_continuous(labels = scales::unit_format(
    suffix = " ",
    big.mark = ".",
    decimal.mark = ","
  )) +
  theme_statgl() +
  theme(plot.margin = margin(10, 10, 10, 10)) +
  scale_color_statgl(reverse = TRUE, 
                     guide = guide_legend(reverse = TRUE)) +
  labs(
    title = "Midellevetid for 0 og 1-årige efter bosted",
    subtitle = "Personer født i Grønland",
    x = "Tid (5-års-intervaller)",
    y = "Middellevetid",
    color = "Alder",
    caption = "Kilde: https://bank.stat.gl/BEDDT5A"
  )

Statistikbanken

Metode


BEXDT5A_raw %>% 
  select(-1) %>% 
  unite(combi, 2, 1, sep = ", ") %>% 
  spread(1, 3) %>% 
  statgl_table(col.names = c(" ", rep(c("By", "Bygd"), 2))) %>% 
  add_header_above(c(" ", "0" = 2, "1" = 2), 
                   align = "r") %>% 
  add_footnote("Middellevetid for 0 og 1-årige, personer født i Grønland.",
               notation = "symbol") %>%
  scroll_box(height = "500px")
0
1
By Bygd By Bygd
1977 - 1981 64,33 61,81 65,01 63,50
1978 - 1982 63,89 61,60 64,74 63,24
1979 - 1983 63,69 59,83 64,45 62,13
1980 - 1984 63,82 59,99 64,51 62,42
1981 - 1985 63,86 59,92 64,53 62,13
1982 - 1986 63,65 60,10 64,30 62,09
1983 - 1987 63,90 59,89 64,34 61,99
1984 - 1988 63,89 61,51 64,29 62,71
1985 - 1989 63,98 62,49 64,38 63,25
1986 - 1990 63,84 62,91 64,28 64,06
1987 - 1991 64,03 62,32 64,64 63,60
1988 - 1992 64,18 63,66 64,71 64,47
1989 - 1993 64,42 63,48 65,06 64,40
1990 - 1994 64,63 63,25 65,31 64,12
1991 - 1995 65,12 62,35 65,73 62,68
1992 - 1996 65,38 63,15 65,99 62,83
1993 - 1997 65,00 63,57 65,74 63,11
1994 - 1998 64,86 64,12 65,56 63,40
1995 - 1999 64,94 63,74 65,61 62,80
1996 - 2000 65,09 65,10 65,72 64,22
1997 - 2001 65,25 65,15 65,66 64,41
1998 - 2002 66,04 64,44 66,34 63,91
1999 - 2003 66,77 64,84 66,86 64,33
2000 - 2004 67,20 65,23 67,16 65,05
2001 - 2005 67,63 64,86 67,39 64,79
2002 - 2006 68,10 65,08 67,90 65,16
2003 - 2007 68,38 65,86 68,16 65,74
2004 - 2008 68,71 65,72 68,45 65,91
2005 - 2009 69,18 66,95 68,79 66,98
2006 - 2010 69,26 67,07 68,90 66,95
2007 - 2011 69,39 67,85 68,97 67,61
2008 - 2012 69,77 67,87 69,27 67,87
2009 - 2013 69,93 67,82 69,47 67,53
2010 - 2014 70,13 67,80 69,74 67,46
2011 - 2015 70,56 69,14 70,22 68,84
2012 - 2016 70,89 69,02 70,54 68,47
2013 - 2017 70,81 69,60 70,49 68,72
2014 - 2018 70,89 69,56 70,54 68,68
2015 - 2019 70,73 68,74 70,41 68,08
* Middellevetid for 0 og 1-årige, personer født i Grønland.

Dødelighed


GS Andersstandardiseret dødelighedsrate
# Helper function:
age_adjust <- function(count, pop, rate = NULL, stdpop){
  if (missing(count) & !missing(pop) & is.null(rate)) {
    count <- rate * pop
  }
  
  if (missing(pop) & !missing(count) & is.null(rate)) {
    pop <- count/rate
    pop[!is.finite(pop)] <- 0
  }
  
  if (is.null(rate) & !missing(count) & !missing(pop)){
    rate <- count/pop
    rate[!is.finite(rate)] <- 0
  }

  
  cruderate <- sum(count)/sum(pop)
  stdwt <- stdpop/sum(stdpop)
  dsr <- sum(stdwt * rate)
  
  tibble(`crude_rate` = cruderate, `std_rate` = dsr)
}

# Import
BEDBBDM1_raw <-
  statgl_url("BEXBBDM1", lang = "da") %>% 
  statgl_fetch(type = px_all(),
               age = px_all(),
               .col_code = TRUE) %>% 
  as_tibble() %>% 
    rename(c("alder" = 1,
             "art" = 2,
             "tid" = 3,
             "Dødsfald" = 4))

BEDBBM1 <- BEDBBDM1_raw %>% as_tibble() %>% spread(art, Dødsfald) %>% 
  mutate_at(1:2, strtoi) 


BEDBBM1_2000 <- BEDBBM1 %>% filter(tid == 2000) %>% pull(Middelfolketal)

BEDBBM1_std <- BEDBBM1 %>% 
  group_by(tid) %>% 
  summarise(age_adjust(Døde, Middelfolketal, stdpop = BEDBBM1_2000) * 1000) %>% 
  ungroup()

BEDBBM1_std %>% 
  ggplot(aes(x = tid, y = std_rate)) +
  geom_line(size = 2, color = statgl:::statgl_cols("darkblue")) +
  theme_statgl() +
  labs(
    title = "Dødelighed", subtitle = "Aldersstandardiseret - Baseår 2000",
    x = "Tid", y = "Aldersstandardiseret rate (pr. 1000)"
  )

Statistikbanken

Metode


# Helper function:
age_adjust <- function(count, pop, rate = NULL, stdpop){
  if (missing(count) & !missing(pop) & is.null(rate)) {
    count <- rate * pop
  }
  
  if (missing(pop) & !missing(count) & is.null(rate)) {
    pop <- count/rate
    pop[!is.finite(pop)] <- 0
  }
  
  if (is.null(rate) & !missing(count) & !missing(pop)){
    rate <- count/pop
    rate[!is.finite(rate)] <- 0
  }

  
  cruderate <- sum(count)/sum(pop)
  stdwt <- stdpop/sum(stdpop)
  dsr <- sum(stdwt * rate)
  
  tibble(`crude_rate` = cruderate, `std_rate` = dsr)
}

# Import
BEDBBDM1_raw <-
  statgl_url("BEXBBDM1", lang = "da") %>% 
  statgl_fetch(type = px_all(),
               age = px_all(),
               .col_code = TRUE) %>% 
  as_tibble() %>% 
    rename(c("alder" = 1,
             "art" = 2,
             "tid" = 3,
             "Dødsfald" = 4))


BEDBBM1 <- BEDBBDM1_raw %>% as_tibble() %>% spread(art, Dødsfald) %>% 
  mutate_at(1:2, strtoi) 


BEDBBM1_2000 <- BEDBBM1 %>% filter(tid == 2000) %>% pull(Middelfolketal)

BEDBBM1_std <- BEDBBM1 %>% 
  group_by(tid) %>% 
  summarise(age_adjust(Døde, Middelfolketal, stdpop = BEDBBM1_2000) * 1000) %>% 
  ungroup()


BEDBBM1_std %>% 
  set_names(str_to_title(names(.) %>% str_replace("_", " "))) %>% 
  statgl_table()
Tid Crude Rate Std Rate
1.977 7,547093 9,604718
1.978 6,277426 8,201016
1.979 7,932343 9,997762
1.980 7,569269 9,318777
1.981 7,466196 8,743659
1.982 7,898405 9,158719
1.983 8,310462 9,694538
1.984 8,343628 9,516114
1.985 8,184076 9,277702
1.986 8,309680 9,504230
1.987 8,222772 9,221694
1.988 7,878324 8,614436
1.989 8,220713 8,946642
1.990 8,402605 8,829735
1.991 8,254037 9,030235
1.992 7,985080 8,538073
1.993 7,820137 8,336611
1.994 8,009792 8,536172
1.995 8,606469 9,126425
1.996 7,943323 8,314272
1.997 8,786185 9,137132
1.998 8,152853 8,372209
1.999 8,541674 8,648833
2.000 8,013962 7,996153
2.001 8,270330 8,127795
2.002 7,885431 7,530775
2.003 7,245483 6,730617
2.004 8,421978 7,693137
2.005 8,170796 7,485152
2.006 7,753304 6,808980
2.007 7,994623 6,718680
2.008 7,600916 6,214598
2.009 7,761024 6,178076
2.010 9,024951 7,273071
2.011 8,401730 6,500936
2.012 8,121163 5,971395
2.013 7,886884 5,680370
2.014 8,217469 5,700447
2.015 8,445160 5,662348
2.016 8,724315 5,726214
2.017 8,937367 5,856937
2.018 8,712297 5,427635
2.019 9,784491 6,073000
2.020 9,249213 5,687933
# Helper function:
age_adjust <- function(count, pop, rate = NULL, stdpop){
  if (missing(count) & !missing(pop) & is.null(rate)) {
    count <- rate * pop
  }
  
  if (missing(pop) & !missing(count) & is.null(rate)) {
    pop <- count/rate
    pop[!is.finite(pop)] <- 0
  }
  
  if (is.null(rate) & !missing(count) & !missing(pop)){
    rate <- count/pop
    rate[!is.finite(rate)] <- 0
  }

  
  cruderate <- sum(count)/sum(pop)
  stdwt <- stdpop/sum(stdpop)
  dsr <- sum(stdwt * rate)
  
  tibble(`crude_rate` = cruderate, `std_rate` = dsr)
}

# Import
BEDBBDM1_raw <-
  statgl_url("BEXBBDM1", lang = "da") %>%
  statgl_fetch(type = px_all(),
               age = px_all(),
               gender = c("M", "K"),
               .col_code = TRUE) %>% 
  as_tibble() %>% 
    rename(c("alder" = 1,
             "art" = 2,
             "køn" = 3,
             "tid" = 4,
             "Dødsfald" = 5))


BEDBBDM1 <- BEDBBDM1_raw %>% as_tibble() %>% spread(art, Dødsfald) %>% 
  mutate_at(c(1, 3), strtoi)

BEDBBDM1_2000 <- BEDBBDM1 %>% arrange(tid, køn, alder) %>% filter(tid == 2000) %>% pull(Middelfolketal)

BEDBBDM1_std <- BEDBBDM1 %>% group_by(tid, køn) %>% arrange(alder) %>% 
  summarise(age_adjust(Døde, Middelfolketal, stdpop = BEDBBDM1_2000) * 1000) %>% 
  ungroup()

BEDBBDM1_std %>% 
  ggplot(aes(
    x = tid, 
    y = std_rate, 
    color = køn
  )) +
  geom_line(size = 2) + 
  theme_statgl() +
  scale_color_statgl(reverse = TRUE) +
  labs(
    title = "Dødelighedsrate efter køn", 
    subtitle = "Aldersstandardiseret - Baseår 2000",
    color = "", 
    x = "Tid",
    y = "Aldersstandardiseret rate (pr.1000)"
  )

Statistikbanken

Metode


# Helper function:
age_adjust <- function(count, pop, rate = NULL, stdpop){
  if (missing(count) & !missing(pop) & is.null(rate)) {
    count <- rate * pop
  }
  
  if (missing(pop) & !missing(count) & is.null(rate)) {
    pop <- count/rate
    pop[!is.finite(pop)] <- 0
  }
  
  if (is.null(rate) & !missing(count) & !missing(pop)){
    rate <- count/pop
    rate[!is.finite(rate)] <- 0
  }

  
  cruderate <- sum(count)/sum(pop)
  stdwt <- stdpop/sum(stdpop)
  dsr <- sum(stdwt * rate)
  
  tibble(`crude_rate` = cruderate, `std_rate` = dsr)
}

# Import
BEDBBDM1_raw <-
  statgl_url("BEXBBDM1", lang = "da") %>%
  statgl_fetch(type = px_all(),
               age = px_all(),
               gender = c("M", "K"),
               .col_code = TRUE) %>% 
  as_tibble() %>% 
    rename(c("alder" = 1,
             "art" = 2,
             "køn" = 3,
             "tid" = 4,
             "Dødsfald" = 5))


BEDBBDM1 <- BEDBBDM1_raw %>% as_tibble() %>% spread(art, Dødsfald) %>% 
  mutate_at(c(1, 3), strtoi)

BEDBBDM1_2000 <- BEDBBDM1 %>% arrange(tid, køn, alder) %>% filter(tid == 2000) %>% pull(Middelfolketal)

BEDBBDM1_std <- BEDBBDM1 %>% group_by(tid, køn) %>% arrange(alder) %>% 
  summarise(age_adjust(Døde, Middelfolketal, stdpop = BEDBBDM1_2000) * 1000) %>% 
  ungroup()

BEDBBDM1_std %>% arrange(køn, tid) %>% select(køn, everything()) %>% 
  set_names(str_to_title(names(.) %>% str_replace("_", " "))) %>% 
  statgl_table(year_col = "Tid")



Tuberkulose


FN 3.3.2 Nye tuberkulosetilfælde pr. 100.000 indbyggere
# Import
TUB01_raw <- read_csv(
  "http://pxweb.fujitsu.dk/sq/1417044b-c578-4c3a-a97d-5056b117ad52",
  locale = locale(encoding = "latin1")) %>%
  as_tibble()

# Transform
TUB01 <-
  TUB01_raw %>% 
  spread(sex, Greenland) %>% 
  rename(Mænd = Men,
         Kvinder = Women) %>% 
  gather(køn, tb, -year) %>% 
  mutate(year = year %>% make_date())

# Plot
TUB01 %>% 
  ggplot(aes(x = year, y = tb, color = køn)) +
  geom_line(size = 2) +
  expand_limits(y = 0) +
  theme_statgl() + scale_color_statgl(reverse = TRUE) +
  labs(
    title = "Diagnostiserede tilfælde af tuberkulose",
    subtitle = "Antal tilfælde per hundredetusinde personer",
    x = " ",
    y = "Tilfælde per hundredetusinde personer",
    color = " ",
    caption = "Kilde: Nordic Health and Social Statistics, tabel TUB01"
  )

Tabel, NOMESCO


# Import
TUB01_raw <- read_csv(
  "http://pxweb.fujitsu.dk/sq/1417044b-c578-4c3a-a97d-5056b117ad52",
  locale = locale(encoding = "latin1")) %>%
  as_tibble()


# Transform
TUB01 <- 
  TUB01_raw %>% 
  mutate(Greenland = Greenland * 10^-2) %>% 
  spread(1, 3) %>% 
  select(1, 3, 2)

# Table
TUB01 %>% 
  statgl_table(year_col = year,
               col.names = c(" ", "Kvinder", "Mænd")) %>% 
  add_footnote("Antal diagnostiserede tilfælde af tuberkulose per tusinde personer.",
               notation = "symbol")
Kvinder Mænd
2000 1,110 0,500
2001 2,174 1,565
2002 1,538 1,433
2003 1,269 1,867
2004 1,282 1,154
2005 1,651 1,781
2006 1,048 1,491