I would like to create a vector of characters that will display all the possible Hours/Minutes of the day.
Hence, I would like to create a vector that looks like this
hours_mins = c("0:00", "0:01",....,"5:09", "5:10", "5:11", "5:12", "5:14", "5:15",..., "23:58", "23:59" )
However, my problem in creating this vector is that the hour displayed in hours_mins is not in the regular format, i.e. 00:00, or 05:09. Hence, how do I create a vector such as hours_mins with truncated display of the hour?
>Solution :
Here’s a base R solution:
sub("^0","", strftime(as.POSIXct("00:00", format="%H:%M")+seq(0,86380,by=60), format="%H:%M") )