[R-sig-Finance] Problem using merge with a loop and get.hist.quote
Achim Zeileis
Achim.Zeileis at wu-wien.ac.at
Tue Jun 6 22:32:44 CEST 2006
On Sun, 4 Jun 2006 03:00:22 -0400 Gabor Grothendieck wrote:
> zoo has a function called index and by using a variable called
> index the code gets confused.
>
> Use another name.
Another solution to the problem is to give zoo a NAMESPACE. As we wanted
to do this for a long time, Gabor and I have revised the package
accordingly and with zoo 1.1-0 (which will become available in the next
days) this problem will not persist anymore.
Best,
Z
> On 6/4/06, Michael Cohen <michaelbcohen at gmail.com> wrote:
> > I have a problem trying to use a loop structure to download prices
> > from Yahoo.
> > When I try the following code segment:
> >
> > library(tseries)
> > # Initialize price vector
> > prices <- get.hist.quote("^dji", start = "2006-01-01", compress =
> > "m")[, "Close"]
> > # Now download individual securities
> > indices <- c("OEX", "IXIC")
> > for (index in indices)
> > {
> > symbol = paste("^", index, sep="")
> > p <- get.hist.quote(symbol, start = "2006-01-01", compress =
> > "m")[, "Close"]
> > prices <- merge(prices, p, all = FALSE)
> > }
> >
> > I get the error message:
> > "Error in get(x, envir, mode, inherits) : variable "OEX" of mode
> > "function" was not found".
> >
> > The prices for the first item in the index series appears to be
> > downlaoded correctly, but the "merge" fails?
> >
> > I have a lot of equities to process, so doing it by hand would be
> > very unpleasant.
> > Any help wold be appreciated.
> > (As you might have guessed, I am not a programmer!)
> >
> > Michael.
> >
> > --
> > Michael B Cohen
> > Southern Cross University
> >
> > [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-SIG-Finance at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> >
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>
More information about the R-SIG-Finance
mailing list