I have some data, for example:
Date CAC Index
2014-10-10 4073,71
2014-10-17 4033,18
2014-10-24 4128,9
But when I put it into R with XLConnect library I get the following:
wb<-loadWorkbook(file.choose())
lp<-getSheets(wb)
data=lapply(seq_along(lp),function(i) readWorksheet(wb,sheet=lp[i],startRow=1))[[1]]
data[,1]=as.character(data[,1])
tail(data,3)[,c(1,4)]
Date CAC.Index
719 2014-10-09 22:00:00 4073.71
720 2014-10-16 22:00:00 4033.18
721 2014-10-23 22:00:00 4128.90
Why don't I get the same dates? In example: I dont get 2014-10-24, instead I get 2014-10-23 22:00:00
Might it be an issue with
ttz<-Sys.getenv('TZ')
Sys.setenv(TZ='GMT')
? Best regards
I think it comes from importing data as GMT and converting it to your local timezone, which seems to GMT-2, therefore 2014/10/10 00:00
is set to 2014/10/09 22:00
.
Maybe you could solve this by specifying your tz according to OlsonNames() list or specify your date column is Date
instead of POSIXct
.