Afternoon,
Bit of an odd one, but is this possible in R Studio?
I have a dataframe that looks like this
DF <- tibble::tribble(
~Location, ~Start.Time, ~End.Time, ~Split.Shift,
"Area 1", "22/01/2021 06:00", "22/01/2021 13:00", "No",
"Area 2", "23/01/2021 12:00", "23/01/2021 22:00", "No",
"Area 1", "24/01/2021 21:00", "25/01/2021 06:00", "Yes"
)
What I would like to see is that when Split.Shift = "Yes", to split the last 2 hours off the shift, create a new row and change the location? Desired output:
tibble::tribble(
~Location, ~Start.Time, ~End.Time, ~Split.Shift,
"Area 1", "22/01/2021 06:00", "22/01/2021 13:00", "No",
"Area 2", "23/01/2021 12:00", "23/01/2021 22:00", "No",
"Area 1", "24/01/2021 21:00", "25/01/2021 04:00", "Yes",
"Area 2", "25/01/2021 04:00", "25/01/2021 06:00", "Yes"
)
Any suggestions would be massively appreciated!
Thank you,