I'm using fwrite to write a csv in R.
I've noticed that the csv was written has different values in the POSIXct columns that seem to be off from the original values by one hour (though I'm unsure if it's consistently off by an hour or by random values).
For example, if I start with the following data (the datetimes are classed as POSIXct):
View(test)
Id | Date
---+--------------------------
01 | 2016-10-26 08:19:00
02 | 2016-10-26 09:05:00
03 | 2016-10-26 09:15:00
04 | 2016-10-26 09:15:00
05 | 2016-10-26 09:28:00
after
fwrite(test, file = "test.csv", quote = TRUE)
nexttest <- fread("M:\\test.csv", sep = ",", header = TRUE)
View(nexttest)
the return is
Id | Date
---+--------------------------
01 | 2016-10-26T07:19:00Z
02 | 2016-10-26T08:05:00Z
03 | 2016-10-26T08:15:00Z
04 | 2016-10-26T08:15:00Z
05 | 2016-10-26T08:28:00Z
etc etc
the outcome is the same using read.table.
I presume I'm missing out an argument in the fwrite statement. Any ideas?
sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United
Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
dput(head(test))
Date.Created = structure(c(1477919160, 1477915320, 1477936980,
1477919820, 1477917780, 1477909680), class = c("POSIXct",
"POSIXt"), tzone = "")