knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(didor)
library(tidyverse)
library(ggplot2)

Download data for gas and electricity consumption

data <- datasets() %>%
  dido_search('gaz') %>%
  dido_search('fr:region') %>% 
  datafiles() %>%
  get_data(query = c(REGION_CODE = 'in:11,44')) %>% 
  mutate(CONSO = parse_number(CONSO), PDL = parse_number(PDL)) %>% 
  group_by(ANNEE, FILIERE, REGION_LIBELLE, REGION_CODE) %>% 
  summarise(CONSO=sum(CONSO, na.rm=TRUE))

Draw graphic

data %>% 
  ggplot2::ggplot(aes(x = ANNEE, y = CONSO, colour = FILIERE, shape = FILIERE)) +
  geom_point() +
  facet_wrap(~ REGION_LIBELLE)


nbc/didor documentation built on Dec. 22, 2021, 12:04 a.m.