?returns not applicable to zoo objects anymore???
Also zoo could be used (see ?diff.zoo): diff(log(sp500))
On Mon, Oct 27, 2008 at 1:31 AM, Brian G. Peterson <brian at braverock.com> wrote:
I'm not running R 2.8.0 yet, so I can't comment on your error specifically, but I will note that function Return.calculate from package PerformanceAnalytics will work with your zoo object from get.hist.quote for calculating returns from prices. rsp500 <- Return.calculate(get.hist.quote(ticker[1], start = from, end = till, compression=freque[fq], quote="Close")) Regards, - Brian Bastian Offermann wrote:
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
_______________________________________________ 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.
[[alternative HTML version deleted]]
_______________________________________________ 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.