I am using the dbGetQuery function from the DBI package to pull a time series from my database.
data <- dbGetQuery(db, "SELECT datetime, value FROM myTable ORDER BY datetime)
If I select a date range that does not include daylight savings, everything comes out fine, however if daylight savings is included in the date range the time stamp is dropped (e.g. every entry is a POSIXct value with only the date). I tested it up to the 15 minutes before and after daylight savings time on March 9th, 2014 to confirm that that was in fact the issue.
# Right before daylight savings
> summary(data)
datetime value
Min. :2013-12-31 08:00:00 Min. : 90.54
1st Qu.:2014-01-17 06:11:15 1st Qu.:132.12
Median :2014-02-03 04:22:30 Median :150.03
Mean :2014-02-03 04:22:30 Mean :186.38
3rd Qu.:2014-02-20 02:33:45 3rd Qu.:249.12
Max. :2014-03-09 00:45:00 Max. :358.56
# Right after daylight savings
> summary(data)
datetime value
Min. :2013-12-31 00:00:00 Min. : 90.54
1st Qu.:2014-01-17 00:00:00 1st Qu.:131.94
Median :2014-02-03 00:00:00 Median :149.58
Mean :2014-02-03 04:58:24 Mean :185.67
3rd Qu.:2014-02-20 00:00:00 3rd Qu.:247.68
Max. :2014-03-10 00:00:00 Max. :358.56
> str(data)
'data.frame': 6600 obs. of 2 variables:
$ datetime: POSIXct, format: "2013-12-31" "2013-12-31" "2013-12-31" "2013-12-31" ...
$ value : num 131 132 131 129 128 ...
This is the same issues as: RODBC loses time values of datetime when result set is large, however the answer there doesn't have a work around for the DBI package that I can find.