[R] xts/zoo index problem?

Huzefa Khalil huzefa.khalil at umich.edu
Tue Jan 19 03:39:10 CET 2016


Well it works when you don't put the milliseconds because it is
matching that part of the date which is provided. Hence, the following
all work:

a["2016-01-18 15:31:54.0"]
a["2016-01-18 15:31:54"]
a["2016-01-18 15:31"]
a["2016-01-18 15"]

However, what I don't get is why it is showing 1453149114.079 as
"2016-01-18 15:31:54.078". It should be showing it as "2016-01-18
15:31:54.079".

Anybody?

On Mon, Jan 18, 2016 at 9:31 PM, ce <zadig_1 at excite.com> wrote:
>
> yes it shows , more interesting :
>
>>  a["2016-01-18 15:31:54.0"]
>                     value
> 2016-01-18 15:31:54     2
>
>> a["2016-01-18 15:31:54.07"]
>      value
>
>> a["2016-01-18 15:31:54.079"]
>                     value
> 2016-01-18 15:31:54     2
>
>
> why it doesn't work with .07 milisecond  but work with .079  and .0 ??
>
>
> -----Original Message-----
> From: "Huzefa Khalil" [huzefa.khalil at umich.edu]
> Date: 01/18/2016 09:26 PM
> To: "ce" <zadig_1 at excite.com>
> CC: r-help at r-project.org
> Subject: Re: [R] xts/zoo index problem?
>
> Try
>
> a["2016-01-18 15:31:54.079"]
>
> The question though is why R displays the milliseconds as "078", when
> it is clearly "079"...
>
> -h
>
>
>
> On Mon, Jan 18, 2016 at 8:55 PM, ce <zadig_1 at excite.com> wrote:
>> Dear all,
>>
>> I have this code :
>>
>> library(xts)
>> a <- structure(c(1,2), class = c("xts", "zoo"), .indexCLASS = c("POSIXct",
>> "POSIXt"), .indexTZ = "", tclass = c("POSIXct", "POSIXt"), tzone = "", index = structure(c(1453137885.23,
>> 1453149114.079), tzone = "", tclass = c("POSIXct", "POSIXt")), .Dim = c(2L,
>> 1L), .Dimnames = list(NULL, "value"))
>>
>> a
>>
>> a["2016-01-18 12:24:45.230"]
>> #                    value
>> #2016-01-18 12:24:45     1
>>
>> a["2016-01-18 15:31:54.078"]
>> #                   value
>>
>> Why second line doesn't show the value? Something to do with miliseconds ?
>> Thanks
>> CE
>>
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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.
>
>



More information about the R-help mailing list