[R-SIG-Finance] error in plot() with fGarch object from saved .RData file

Brian G. Peterson brian at braverock.com
Tue Jul 28 21:08:41 CEST 2009

On Windows, R saves your workspace automagically on quitting in a file 
in the working directory called .RData

if I have a garchFit object 'gf' it will plot correctly immediately 
after fitting.

However, it will fail after reloading:

 > plot(gf)
Error in as.double(y) :
  cannot coerce type 'S4' to vector of type 'double'

but the corresponding .plot.garch.#() functions will still work.

I can replicate this behavior on linux as well by fitting and then 
saving a garchFit object.  On loading the object, it will fail to S4 
method dispatch on plot() again.

Using R 2.9.1 and the CRAN version of the RMetrics packages

Any ideas on how to avoid this behavior? 

It's only an annoyance, but it does make it difficult for me to share 
data internally if I can't just save the object and have it displayable 
by my coworkers.


  - Brian

Brian G. Peterson
Ph: 773-459-4973
IM: bgpbraverock

More information about the R-SIG-Finance mailing list