My dataframe has this structure:
str(marc)
$ Data : Date, format: "2015-10-31" "2015-10-31" "2015-10-31" ...
$ Hora :Class 'times' atomic [1:351] 0.792 0.792 0.792 0.792 0.5 ...
.. ..- attr(*, "format")= chr "h:m:s"
I am trying to create a new column joining Data and Hora:
marc$Timestamp=as.POSIXct(paste(marc$Data, marc$Hora), format = "%Y-%m-%d %H:%M:%S")
But as.POSIXct is returning NAs.
$ Timestamp: POSIXct, format: NA NA NA ...
I used the same process to create a Timestamp with other dataframe and it have worked. What I am doing wrong this time? Thank you very much!
> dput(marc$Hora)
structure(c(0.791666666666667, 0.791666666666667, 0.791666666666667,
0.791666666666667, 0.5, 0.833333333333333, 0.833333333333333,
0.833333333333333, 0.708333333333333, 0.833333333333333, 0.708333333333333,
0.708333333333333, 0.604166666666667, 0.604166666666667, 0.604166666666667,
0.708333333333333, 0.8125, 0.75, 0.541666666666667, 0.75, 0.541666666666667,
0.541666666666667, 0.541666666666667, 0.8125, 0.8125, 0.520833333333333,
0.8125, 0.8875, 0.9375, 0.9375, 0.9375, 0.8875, 0.895833333333333,
...
format = "h:m:s", class = "times")
Before use POSIXct, I ran:
marc$Hora=times(marc$Hora)
Hora should be H:M:S, but it didn't change