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

Luis Torgo ltorgo at inescporto.pt
Wed May 6 00:00:34 CEST 2009


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



More information about the R-SIG-Finance mailing list