[R] Precision error in time index of ts objects

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Fri Sep 1 17:52:52 CEST 2017

You already know the answer. Why ask? 
Sent from my phone. Please excuse my brevity.

On September 1, 2017 7:23:24 AM PDT, Andrea Altomani <altomani.andrea at gmail.com> wrote:
>I have a time series x, and two other series obtained from it:
>x <- structure(2017, .Tsp = c(2017.41666666667, 2017.41666666667, 12),
>class = "ts")
>y <- floor(x)
>z <- x-y
>I would expect the three series to have exactly the same index.
>However I get the following
>> time(x)-time(y)
>     Jun
>2017   0
>as expected, but
>> time(x)-time(z)
>Warning message:
>In .cbind.ts(list(e1, e2), c(deparse(substitute(e1))[1L],
>deparse(substitute(e2))[1L]),  :
>  non-intersecting series
>and indeed, comparing the indices gives:
>> time(x)[1]-time(z)[1]
>[1] 3.183231e-12
>Is this a bug in R, or is it one of the expected precision errors due
>to the use of limited precision floats?
>I am using R 3.4.0 (2017-04-21) on Windows (64-bit).
>Andrea Altomani
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list