[R] Weird POSIXct behaviour

Joshua Ulrich josh.m.ulrich at gmail.com
Sun Mar 25 22:22:19 CEST 2012


On Sun, Mar 25, 2012 at 3:01 PM, Worik R <worikr at gmail.com> wrote:
> My bad.  I should be clearer about the source of my confusion.
>
> Given two identical string representations of POSIXct objects, can the two
> objects represent different times?
>
Yes.  Here's an example (from my Ubuntu machine) of one way:

> (t1 <- Sys.time()); (t2 <- Sys.time())+0.001; t1 == t2
[1] "2012-03-25 15:13:48 CDT"
[1] "2012-03-25 15:13:48 CDT"
[1] FALSE
> options(digits.secs=3)
> (t1 <- Sys.time()); (t2 <- Sys.time())+0.001; t1 == t2
[1] "2012-03-25 15:17:36.520 CDT"
[1] "2012-03-25 15:17:36.523 CDT"
[1] FALSE

>
>> > Where has it gone?
>> >
>> It's hard to say, especially since you give no indication how you
>> assigned the value to Time.  A reproducible example, as requested in
>> the posting guide, would be helpful.  Also, what version of R, xts,
>> and zoo are you using?
>>
>>
> Browse[2]> Time
> [1] "2012-03-20 00:59:57 NZDT"
>
> Browse[2]> index(DATA.ba[[p]]["2012-03-20 00:59:57","bid"])
> [1] "2012-03-20 00:59:57 NZDT"
>
> A reproducible example would be huge at this point.  WHat I need is an
> answer to that simple question.  If the answer is  "No" then it is worth
> doing the work for a reproducible example.  If "Yes" I need to learn why
> and better ways of pasing the objects in and out of matrices and vectors.
>
No need for it to be huge.  dput(DATA.ba[[p]]["2012-03-20
00:59:57","bid"]) would be a sufficient start.

> Using R version  2.12.1
>
> The zoo documentation (?zoo) does not include a version.  Where can I find
> it?
>
>From the output of sessionInfo(), or packageDescription("zoo").  The
output from sessionInfo() would be more helpful because it provides
more information about your installation.

> Worik
>
>

--
Joshua Ulrich  |  FOSS Trading: www.fosstrading.com

R/Finance 2012: Applied Finance with R
www.RinFinance.com



More information about the R-help mailing list