Hello,
Check the structure of what you have, df and newdf. You will see that in
df dateTime is of class POSIXlt and in newDf newDateTime is of class
POSIXct.
Solution:
[...]
df$dateTime <- strptime(df$dateTime,"%m/%d/%Y %H:%M")
df$dateTime <- as.POSIXct(df$dateTime)
[...]
Hope this helps,
I have the following dataframe with the first column being of type datetime:
dateTime <- c("10/01/2005 0:00",
"10/01/2005 0:20",
"10/01/2005 0:40",
"10/01/2005 1:00",
"10/01/2005 1:20")
var1 <- c(1,2,3,4,5)
var2 <- c(10,20,30,40,50)
df <- dat
2 matches
Mail list logo