Re: [R] feeding merge.zoo a vector containing the names of zoo objects?

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Sat, 15 Mar 2008 10:43:27 -0400

Try using do.call:

library(tseries)
adjClose0 <- sapply(LETTERS[1:3], get.hist.quote, quote = "AdjClose",

    simplify = FALSE)
adjClose <- do.call(merge, c(adjClose0, retclass = "data.frame"))

On Sat, Mar 15, 2008 at 9:37 AM, rich.p.martin <rich.p.martin_at_gmail.com> wrote:
>
> Hi, the snippet of code below works, but I would like to know how to feed the
> function merge.zoo the contents of
> CADstocknames rather than having to hard code it into the merge.zoo command.
> I think I must be missing something simple, but I cannot for the life of me
> figure it out. Thanks in advance for any enlightenment offered.
>
>
> library(zoo)
> CADstocknames <- c("xbb.to","xsb.to","xiu.to")
> for(i in 1:length(CADstocknames)){
> assign(CADstocknames[i], get.hist.quote(CADstocknames[i],quote =
> "AdjClose"))
> }
> mergedCAD <- merge.zoo(xbb.to,xsb.to,xiu.to, all = TRUE, retclass
> ="data.frame")
> tail(mergedCAD)
>
>
>
> --
> View this message in context: http://www.nabble.com/feeding-merge.zoo-a-vector-containing-the-names-of-zoo-objects--tp16067806p16067806.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sat 15 Mar 2008 - 14:47:43 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 15 Mar 2008 - 15:30:22 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive