I would like to sort my data table after time using setorder.
library(data.table)
DT <- data.table(timestamp=c(as.POSIXct("2013-01-01 17:54:23.577"),
as.POSIXct("2013-01-01 17:54:23.568"),
as.POSIXct("2013-01-01 17:54:23.909"),
as.POSIXct("2013-01-01 17:54:23.901")))
setorder(DT,timestamp)
print(DT)
Outputs:
timestamp
1: 2013-01-01 17:54:23.568
2: 2013-01-01 17:54:23.576
3: 2013-01-01 17:54:23.908
4: 2013-01-01 17:54:23.901
Setorder fails to correctly sort the data table and I am not sure why. Is it possible to somehow increase the sensitivity or any other possible solution?