1 2 3 4 5 6 7 8 9 10 11 12 13
|
## les libraries ggplot2, dplyr, tidyr, lubridate, stringr
classer_heure <- function(heure){
heure_exacte <- str_pad(hour(heure),width = 2, side = 'left',pad = '0') ## on récupère l'heure et on ajoute à gauche un zéro si besoin
minu <- minute(heure)
classe <- ifelse(minu<30,str_c(heure_exacte,"_","0-29"),str_c(heure_exacte,"_","30-59"))
}
renard <- read_csv2("../Downloads/Renard.csv")
renard_long <- renard %>% gather(num_heure,heure,2:3) %>%
mutate(classe_heure = classer_heure(heure)) |