[R-SIG-Finance] Problem with Delt() from quantmod

Jeff Ryan jeff.a.ryan at gmail.com
Wed May 6 05:25:23 CEST 2009


Hi Luis,

The documentation for Delt indicates that k with a vector of values
*should* work.  Clearly that was broken somewhere by me.

I have now made the necessary changes to allow for k to be a vector.
They are reflected in the R-forge version.

Thanks,
Jeff

On Tue, May 5, 2009 at 5:00 PM, Luis Torgo <ltorgo at inescporto.pt> wrote:
> Dear All,
>
> I'm having a problem with using Delt() on a xts object with a vector of
> k values. With a single k value I have no problems and with vector of
> values instead of a xts object I'm also able to get what I want. Let's
> see illustrative examples:
>>
>> x
>
>          GSPC.Adjusted
> 2009-04-01        811.08
> 2009-04-02        834.38
> 2009-04-03        842.50
> 2009-04-06        835.48
> 2009-04-07        815.55
> 2009-04-08        825.16
> ...
>>
>> class(x)
>
> [1] "xts" "zoo"
>>
>> Delt(x)
>
>          Delt.1.arithmetic
> 2009-04-01                NA
> 2009-04-02       0.028727129
> 2009-04-03       0.009731777
> 2009-04-06      -0.008332344
> ...
>>
>> Delt(x,k=1:3)
>
> Error in attributes(.Data) <- c(attributes(.Data), attrib) :
>  length of 'dimnames' [1] not equal to array extent
>
> Any help is most welcome.
>
> Thanks,
> Luis
>
> --
> Luis Torgo
>  FC/LIAAD - INESC Porto, LA    Phone : (+351) 22 339 20 93
>  University of Porto           Fax   : (+351) 22 339 20 99
>  R. de Ceuta, 118, 6o          email : ltorgo at liaad.up.pt
>  4050-190 PORTO - PORTUGAL     WWW   : http://www.liaad.up.pt/~ltorgo
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>



-- 
Jeffrey Ryan
jeffrey.ryan at insightalgo.com

ia: insight algorithmics
www.insightalgo.com



More information about the R-SIG-Finance mailing list