How to find the average consumption by hours

In fact, it was the Tidyverse. I was stuck with it. Hence I read : https://r4ds.had.co.nz/
within an hour I found the simple one command that I needed.

For every begginner that aim to do data description, only one night of reading will make you save hours.

This was the lines :

library(tidyverse)
library(dplyr)

X2009_2018_heure <- read_excel("C:Dropbox/Projet Éolien/Data/HQ/2009_2018_heure.xlsx")

HQ <- X2009_2018_heure %>%
pivot_longer(c(2009,2010,2011,2012,2013,2014,2015,2016,2017,2018), names_to = "Year", values_to = "Consumption")

Hence After I can subdivise it as much as I want:

HQ_H_Y <- HQ %>%
group_by(Year,heure) %>%
summarise(hours_mean = mean(Consumption, na.rm = TRUE))

This one gives :
Year heure hours_mean

2009 1 17994.
2009 2 17828.
2009 3 17815.

HQ_H_M_Y_Q_1 <- HQ %>%
group_by(mois,heure,Year) %>%
dplyr::summarise( Quantile1 = quantile(Consumption, c(.10), na.rm = TRUE),
Quantile2 = quantile(Consumption, c(.20), na.rm = TRUE),
Quantile3 = quantile(Consumption, c(.30), na.rm = TRUE),
Quantile4 = quantile(Consumption, c(.40), na.rm = TRUE),
Quantile5 = quantile(Consumption, c(.50), na.rm = TRUE),
Quantile6 = quantile(Consumption, c(.60), na.rm = TRUE),
Quantile7 = quantile(Consumption, c(.70), na.rm = TRUE),
Quantile8 = quantile(Consumption, c(.80), na.rm = TRUE),
Quantile9 = quantile(Consumption, c(.90), na.rm = TRUE),
Quantile10 = quantile(Consumption, c(1.00), na.rm = TRUE))

This one is more complex :

mois heure Year Quantile1 Quantile2 Quantile3 Quantile4 Quantile5 Quantile6 Quantile7 Quantile8 Quantile9 Quantile10
1 1 2009 24089 24386 24793 24967 25226 25937 26586 27767 28104 30374