[R] Rmetrics: Problem with "align"

Gero Schwenk gero.schwenk at web.de
Mon Sep 7 11:55:37 CEST 2009


Hi there!
I'm stuck with a problem aligning financial timeseries and haven't found 
a cue how to fix it...

When I run that simple script, everything goes well until the 
"align"-command:

------
rm(list=ls())
x <- yahooSeries("^GDAXI")
head(x)
xAligned <- align(x = x, by = "1d", method = "before", include.weekends 
= FALSE)
------

Here's the command-line dialog:

------
 > rm(list=ls())
 > x <- yahooSeries("^GDAXI")
versuche URL 
'http://chart.yahoo.com/table.csv?s=^GDAXI&a=&b=&c=&d=8&e=07&f=2009&g=d&x=.csv'
Content type 'text/csv' length unknown
URL geöffnet
.......... .......... .......... .......... ..........
.......... .......... .......... .......... ..........
.......... .......... .......... .......... ..........
.......... .......... .......... .......... ..........
.......... .......... .......... .......... ..........
......
downloaded 256 Kb

 > head(x)
GMT
           ^GDAXI.Open ^GDAXI.High ^GDAXI.Low ^GDAXI.Close ^GDAXI.Volume
2009-09-04     5328.59     5404.30    5320.28      5384.43      28535100
2009-09-03     5332.50     5364.03    5278.50      5301.42      25969000
2009-09-02     5325.94     5337.84    5263.11      5319.84      30401300
2009-09-01     5479.35     5507.48    5327.29      5327.29      31245400
2009-08-31     5474.62     5495.56    5437.92      5458.04      10442600
2009-08-28     5512.17     5573.89    5502.46      5517.35      23480600
           ^GDAXI.Adj.Close
2009-09-04          5384.43
2009-09-03          5301.42
2009-09-02          5319.84
2009-09-01          5327.29
2009-08-31          5458.04
2009-08-28          5517.35
 > xAligned <- align(x = x, by = "1d", method = "before", 
include.weekends = FALSE)
Fehler in seq.default(u[1] + offset, u[length(u)], by = by) :
  wrong sign in 'by' argument
-----

Besides, Example-Data (SWX) from the "fPortfolio"-package is aligned 
nicely by exactly the same command. Does anybody have an idea what the 
problem could be? I'm grateful for any help!

Kind regards,
Gero




More information about the R-help mailing list