I want to create a sequence of times 00:00 - 12:00 and 12:00 to 00:00 with 10 minutes step. How can I do this in R?
I have tried with:
library(chron)
t <- merge(0:23, seq(0, 50, by = 10))
chron(time = paste(x$x, ':', x$y), format = c(times = "h:m"))
But I have 2 problems:
- I get an error running
chron(time = paste(x$x, ':', x$y), format = c(times = "h:m"))
:
Error in convert.times(times., fmt) : format h:m may be incorrect
- How can I turn it to standard time with AM/PM? Should I merge it twice:
t <- merge(0:12, seq(0, 50, by = 10))
t_am <- merge(t, "AM")
t_pm <- merge(t, "PM")
Or maybe another way using POSIXt?