Skip to content
Back to formatted view

Raw Message

Message-ID: <43900B55.1080002@itp.phys.ethz.ch>
Date: 2005-12-02T08:52:37Z
From: Diethelm Wuertz
Subject: rMetrics bug
In-Reply-To: <C619AB04-7A0F-473C-9F03-AE2A8FBFC701@mac.com>

# FIX:

rev.timeDate =
function (x)
{
    if (Sys.getenv("TZ")[[1]] != "GMT")
        warning("Set timezone to GMT!")
    if (!inherits(x, "timeDate"))
        stop("Wrong class type")
    # Replace:
    # x at Data = rev(x at Data)
    # with
    x at Data = x at Data[length(x at Data[[1]]):1]
    x
}

# Try:

rev(timeSequence(len=20))

[1] "Zurich"
 [1] [2004-01-20] [2004-01-19] [2004-01-18] [2004-01-17] [2004-01-16]
 [6] [2004-01-15] [2004-01-14] [2004-01-13] [2004-01-12] [2004-01-11]
[11] [2004-01-10] [2004-01-09] [2004-01-08] [2004-01-07] [2004-01-06]
[16] [2004-01-05] [2004-01-04] [2004-01-03] [2004-01-02] [2004-01-01]


Best regards DW



Parlamis Franklin wrote:

>In method rev.timeDate
>
> > rev(timeSequence(len=20))
>[1] "Honolulu"
>[1] [2004-01-09] [2004-01-08] [2004-01-07] [2004-01-06] [2004-01-05]  
>[2004-01-04] [2004-01-03] [2004-01-02]
>[9] [2004-01-01]
>
>
>
>Note the following:
>
> > rev(timeSequence(len=20))@Dim
>[1] 20
>
> > rev(timeSequence(len=20))[15]
>[1] "Honolulu"
>[1] [NA]
>
> > rev(timeSequence(len=5))
>[1] "Honolulu"
>[1] [NA]         [NA]         [NA]         [NA]         [2004-01-05]  
>[2004-01-04] [2004-01-03] [2004-01-02]
>[9] [2004-01-01]
>
>
>
>Class "POSIXlt" is a named list of exactly nine vectors.  hmmmmmm . . .
>
>_______________________________________________
>R-sig-finance at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>
>  
>