[R] isdst warning when rounding a range of time data: fix or suppress?
philippgrueber
philipp.grueber at ebs.edu
Tue Jul 13 17:10:58 CEST 2010
Dear Clay,
dear list,
I face the same problem when rounding POSIXct objects. Have you (or has
anybody) found an explanation meanwhile, or a way to work around this issue?
Example:
opt<-options(digits.secs=3)
ts1<-as.POSIXct(c("2006-11-01 09:00:00.03", "2006-11-01 09:00:01",
"2006-11-01 09:00:01.0245", "2006-11-01 09:00:01.11","2006-11-01 09:00:03"),
tz="GMT")
ra1<-seq(2,6,1)
data<-data.frame(ts1,ra1)
data$lo1<-data$ts1==round.POSIXt(data$ts1,"secs")
data
Even though in this example all results are correct, is there a chance that
incorrect results are returned?
Thanks,Phil
Clay Heaton wrote:
>
> 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,
> Clay
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
--
View this message in context: http://r.789695.n4.nabble.com/isdst-warning-when-rounding-a-range-of-time-data-fix-or-suppress-tp1680540p2287574.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list