[R-sig-finance] rMetrics bug

Diethelm Wuertz wuertz at itp.phys.ethz.ch
Fri Dec 2 09:52:37 CET 2005



# 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
>
>  
>



More information about the R-sig-finance mailing list