When I try to execute the following code on RStudio
library(lubridate)
library(data.table)
a <- data.frame(c("2017-12-01 00:01:00","2017-12-02 00:01:00"),c(5,6))
colnames(a) <- c("t", "x")
a <- as.data.table(a)
a[, t := parse_date_time(t, orders = "ymd HMS")]
print(class(a$t))
paste("a:", format(a[1,1], format = "%Y-%m-%d %H:%M:%S"))
I have the following result:
[1] "a: 2017-12-01 00:01:00"
But when I try to run the same code under Rscript, the output is
[1] "a: 1"
Does anyone have the same problem as me? Any help is appreciated.
EDIT: R version 3.3.1, platform x86_64-w64-mingw32/x64.
Windows server 2012 version:
Major Minor Build Revision
6 2 9200 0