Tilbage


Delmål 7: Bæredygtig energi

Vedvarende energi


GS Klimakorrigeret andel af affaldsvarme og vandkraft efter sektor
# Import
ENE1ACT_raw <-
  read_csv(
    paste0("https://bank.stat.gl:443/sq/ef08d007-6c33-4385-812c-dc082de93f1e.csv", "?lang=", language),
    locale = locale(encoding = "latin1"))


ENE1ACT <-
  ENE1ACT_raw %>% 
  rename(
    "type"       = 1,
    "use"        = 2,
    "time"       = 3,
    "total"      = 4,
    "waste heat" = 5,
    "hydropower" = 6
  ) %>% 
  mutate(across(4:ncol(.), as.numeric)) %>% 
  mutate_all(~replace(., is.na(.), 0)) %>% 
  mutate(other = total - (`waste heat` + hydropower)) %>% 
  gather(energy, value, 5:ncol(.)) %>% 
  select(-4) %>% 
  mutate(energy = energy %>% fct_inorder())


step <-
  ENE1ACT %>% 
  mutate(
    energy = energy %>% str_replace("waste heat", sdg13$figs$fig3$cols$col1[language] %>% unlist()),
    energy = energy %>% str_replace("hydropower", sdg13$figs$fig3$cols$col2[language] %>% unlist()),
    energy = energy %>% str_replace("other",      sdg13$figs$fig3$cols$col3[language] %>% unlist()),
    energy = energy %>% factor(levels = unique(energy)),
    use    = use    %>% factor(levels = unique(use))
  )

  # Plot
step %>% 
  ggplot(aes(
    x    = time,
    y    = value,
    fill = energy
  )) +
  geom_area(position = "fill") +
  facet_wrap(~ use) +
  scale_y_continuous(labels  = scales::percent_format(
    scale        = 100, 
    accuracy     = 1, 
    big.mark     = ".",
    decimal.mark = ","
    )) +
  theme_statgl() + 
  scale_fill_statgl(reverse = TRUE) +
  labs(
    title    = sdg13$figs$fig3$title[language],
    subtitle = ENE1ACT[[1]][1],
    x        = " ",
    y        = " ",
    fill     = sdg13$figs$fig3$fill[language],
    caption  = sdg13$figs$fig3$cap[language]
  )

Statistikbanken

Metode


# Transform
ENE1ACT <-
  ENE1ACT_raw %>% 
  rename(
    "type"       = 1,
    "use"        = 2,
    "time"       = 3,
    "total"      = 4,
    "waste heat" = 5,
    "hydropower" = 6
  ) %>% 
  mutate(across(4:ncol(.), as.numeric)) %>% 
  mutate_all(~replace(., is.na(.), 0)) %>% 
  mutate(other = total - (`waste heat` + hydropower),) %>% 
  gather(energy, value, 5:ncol(.)) %>% 
  select(-4) %>% 
  mutate(energy = energy %>% fct_inorder()) %>% 
  spread(4, 5) %>% 
  filter(time >= year(Sys.time()) - 7) %>% 
  arrange(desc(time))



# Table
ENE1ACT %>% 
  select(-1, -3) %>%
  rename(" " = 1) %>% 
  statgl_table(replace_0s = TRUE,
               col.names = c(" ", colnames(ENE1ACT_raw)[5:6], sdg13$figs$fig3$cols$col3[language])) %>% 
  pack_rows(index = table(ENE1ACT[[1]])) %>% 
  pack_rows(index = table(ENE1ACT[[3]]) %>% rev()) %>% 
  add_footnote(sdg13$figs$fig3$foot[language], notation = "symbol")
Affaldsvarme Vandkraft Andet
Klimakorrigeret forbrug
2016
Energisektoren 96 1.415 1.130
Handels- og serviceerhverv i alt - - 708
Husholdninger - - 1.396
Produktionserhverv i alt - - 2.259
Transport i alt - - 1.636
2015
Energisektoren 87 1.408 1.342
Handels- og serviceerhverv i alt - - 577
Husholdninger - - 1.242
Produktionserhverv i alt - - 2.059
Transport i alt - - 1.578
2014
Energisektoren 90 1.374 1.183
Handels- og serviceerhverv i alt - - 725
Husholdninger - - 1.386
Produktionserhverv i alt - - 2.189
Transport i alt - - 1.485
* Terajoule