-3

In my date set, there is a string varing containing time, such as {"9:30", "10:01", ...}. How can I convert them so that they can be treated as time? Thanks!

1 Answers1

1

We can use times from chron

library(chron)
times(paste(v1, '00', sep=':'))
#[1] 09:30:00 10:01:00

data

v1 <- c('9:30', '10:01')
akrun
  • 874,273
  • 37
  • 540
  • 662