[R] isdst warning when rounding a range of time data: fix or suppress?

Clay Heaton ccheaton at gmail.com
Wed Mar 24 14:28:13 CET 2010

Hi, I'm working with timeseries data. The values are every 5 seconds and each series can last up to 4-5 days.

To generate the x-axis labels, I'm doing the following:

# Variable for displaying hours on the x-axis
rtime <<- as.POSIXct(round(range(timedata), "hours"))

# Variable for displaying days on the x-axis
stime <<- as.POSIXct(round(range(timedata), "days"))

# Plot the hours on the x-axis
axis.POSIXct(1, at=seq(rtime[1], rtime[2], by="hour"), format="%H", cex.axis=.6, lwd=0, lwd.ticks=1, hadj=0.2, las=2, tck=-0.02)

# Plot the days on the x-axis
axis.POSIXct(1, at=seq(stime[1], stime[2], by="day"), format="%A", cex.axis=.7, line=1, lty=0, padj=-1.4)

The data generated and the plots look fine. R issues a warning on the round() function when rtime is set, though. It looks like this:

> round(range(cgmtime), "hours")
[1] "2003-11-04 14:00:00 EST" "2003-11-07 11:00:00 EST"
Warning message:
In if (isdst == -1) { :
  the condition has length > 1 and only the first element will be used

Am I approaching this incorrectly? Is there another way to achieve the same result without the warning? Or is there a way I can suppress the warning?

Thanks in advance,

More information about the R-help mailing list