Skip to content
Prev 3099 / 15274 Next

?returns not applicable to zoo objects anymore???

hello,

does anybody know by any chance why the function ?returns in package 
timeSeries (formerly fSeries) cannot be applied to zoo objects? And 
converting zoo objects into class timeSeries does not seem to work as well.

E.g.

ticker <- c("^GSPC", "MSFT", "MMM", "DAI", "GS")
from <- "1970-10-19"              # of type "YYYY-MM-DD"
till <- "2007-12-31"
freque <- c("d", "w", "m", "y")
fq <- 3                           # input 1 for "d", 2 for "w" etc.

sp500 <- get.hist.quote(ticker[1], start = from, end = till, 
compression=freque[fq], quote="Close")
rsp500 <- returns(get.hist.quote(ticker[1], start = from, end = till, 
compression=freque[fq], quote="Close"))


above code returns error msg.:

Error in .classEnv(thisClass) :
  unable to find an environment containing class "zoo"

I upgraded my version from 2.7.1 to 2.8.0 and found that the package 
fSeries has been changed to timeSeries. ?returns always worked fine as 
coded above and suddenly caused errors as the one above after I had 
installed 2.8.0. I am now using 2.7.1 again, but the error remains. 
operating system is windows vista.

thanks in advance.

regards

bo