split_per_day | R Documentation |
This functions takes a data frame with a column with starting time and another with ending time If the period extends over midnight, it will be split into new lines, starting and ending at midnight
split_per_day(data, horodatedebut, horodatefin)
data |
The dataframe |
horodatedebut |
The beginning time |
horodatefin |
The ending time |
A data frame with four new columns, Hmin (hour min), Hmax (hmax), xmin (day) and xmax (next day), and new rows
cedric.briand
datatemp<-structure(list(per_dis_identifiant = c(1L, 1L, 1L),
per_date_debut = structure(c(1420056600,
1420071000, 1420081200), class = c("POSIXct", "POSIXt"), tzone = ""),
per_date_fin = structure(c(1420071000, 1420081200, 1421000000
), class = c("POSIXct", "POSIXt"), tzone = ""), per_commentaires = c("fonct calcul",
"fonct calcul", "fonct calcul"), per_etat_fonctionnement = c(1L,
0L, 0L), per_tar_code = 1:3, libelle = c("Fonc normal", "Arr ponctuel",
"Arr maint")), .Names = c("per_dis_identifiant", "per_date_debut",
"per_date_fin", "per_commentaires", "per_etat_fonctionnement",
"per_tar_code", "libelle"), row.names = c(NA, 3L), class = "data.frame")
newdf<-split_per_day(data=datatemp,horodatedebut="per_date_debut",
horodatefin="per_date_fin")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.