Skip to content

Subset with time changes timezone #221

Closed
@eibanez

Description

@eibanez

I have found a strange behavior when using subset with dates. As you can see, the timezone in the datetime column changes. Winston also found this behavior on a Mac (https://groups.google.com/forum/#!topic/manipulatr/p39QNVQ8bUg).

I have not checked if the other verbs have a similar impact. Here is a small example, the results and my session info.

CODE

library(dplyr)
library(lubridate)

date.start <- ymd_hms("2014-01-01 00:00:00")
test <- data.frame(Date = date.start + hours(1:10))
test2 <- test %.% filter(Date < date.start + hours(5))

RESULTS

> test$Date[1:5]
[1] "2014-01-01 01:00:00 UTC" "2014-01-01 02:00:00 UTC" "2014-01-01 03:00:00 UTC"
[4] "2014-01-01 04:00:00 UTC" "2014-01-01 05:00:00 UTC"

> test2$Date[1:4]
[1] "2013-12-31 18:00:00 MST" "2013-12-31 19:00:00 MST" "2013-12-31 20:00:00 MST"
[4] "2013-12-31 21:00:00 MST"

SESSION INFO

> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] lubridate_1.3.1 dplyr_0.1      

loaded via a namespace (and not attached):
[1] assertthat_0.1 digest_0.6.4   memoise_0.1    plyr_1.8       Rcpp_0.10.6   
[6] stringr_0.6.2  tools_3.0.2

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions