I have a column representing the time in a data frame in R.
when I call the str () function on a column, it says something like this
>str(df2$Time)
Factor w/ 1441 levels "","00:01","00:02","00:03",..: 1086 1096 1111 and so on
I want to convert this column to a row type so that if the time is less than 12:00, it should be changed to the string "moring", if the time is between 12:00 and 6:00 it is "daylight", etc.
As a first step, I decided to convert this vector to the time type of the data frame column, so I used the chron function.
I typed the following command:
>df2$Time<-chron(times=df2$Time,format=c('h:m'))
Error in convert.times(times., fmt) : format h:m may be incorrect
In addition: Warning message:
In is.na(out$s) : is.na() applied to non-(list or vector) of type 'NULL"
so I figured I should add a second parameter in the format, so I tried the following:
df2$Time<-chron(time=df2$Time,format=c('h:m:s'))
But still there was the same mistake
, , , . - , , , ..
.