Let my time series data be
df <- data.frame(timestamp = c('2021-08-11 12:00:00', '2021-08-11 01:00:00', '2021-08-11 02:00:00', '2021-08-11 03:00:00', '2021-08-11 04:00:00', '2021-08-11 05:00:00', '2021-08-11 06:00:00', '2021-08-11 07:00:00', '2021-08-11 08:00:00', '2021-08-11 09:00:00', '2021-08-11 10:00:00', '2021-08-11 11:00:00', '2021-08-11 12:00:00', '2021-08-11 01:00:00', '2021-08-11 02:00:00', '2021-08-11 03:00:00', '2021-08-11 04:00:00', '2021-08-11 05:00:00', '2021-08-11 06:00:00', '2021-08-11 07:00:00', '2021-08-11 08:00:00', '2021-08-11 09:00:00', '2021-08-11 10:00:00', '2021-08-11 11:00:00' ),
value = c(77,190,17,-4,163,158,25,-2,132,119,-35,165,99,-21,199,62,-1,30,123,42,56,-36,123,24))
My requirement data frame
df <- data.frame(timestamp = c('2021-08-11 00:00:00', '2021-08-11 01:00:00', '2021-08-11 02:00:00', '2021-08-11 03:00:00', '2021-08-11 04:00:00', '2021-08-11 05:00:00', '2021-08-11 06:00:00', '2021-08-11 07:00:00', '2021-08-11 08:00:00', '2021-08-11 09:00:00', '2021-08-11 10:00:00', '2021-08-11 11:00:00', '2021-08-11 12:00:00', '2021-08-11 13:00:00', '2021-08-11 14:00:00', '2021-08-11 15:00:00', '2021-08-11 16:00:00', '2021-08-11 17:00:00', '2021-08-11 18:00:00', '2021-08-11 19:00:00', '2021-08-11 20:00:00', '2021-08-11 21:00:00', '2021-08-11 22:00:00', '2021-08-11 23:00:00' ),
value = c(77,190,17,-4,163,158,25,-2,132,119,-35,165,99,-21,199,62,-1,30,123,42,56,-36,123,24))
The original data is of the interval per minute or per second.
here the first
df$timestamp[1] = [1] "2021-08-11 12:00:00"
is of AM, i.e. 00 hrs after night.
I want to convert the timestamp column to 24 hours format.
I want to have my timestamp like this