0

I tried to convert a column containing time details from characters to a time type variable. The code works but converts all the characters into NA. The values in the column before the code looks like '06:34:10'

The code I am running is similar to this:

df$time <- as.POSIXct(df$time, format = "%H-%M-%S")

I want it to be a time variable so I can conduct analyses by grouping the different times an event occurred.

Rohan
  • 1
  • 1

1 Answers1

0

: instead to -

df$time <- as.POSIXct(df$time, format = "%H:%M:%S")

or

df$time <- strptime(df$time, format = "%H:%M:%S")