[R] Error with rbind and zoo

Gabor Grothendieck ggrothendieck at gmail.com
Tue Jan 8 04:26:09 CET 2008


Suggest you read the posting guide and in particular
read the last line on every message to r-help.  Also
the line wrapping on your email makes it unreadable.

On Jan 7, 2008 7:09 PM, Kondamani, Arjun (GMI - NY Corporate Bonds)
<arjun_kondamani at ml.com> wrote:
> Hi all:
>
> I have a directory of files as in -------------> bunchafiles <-
> list.files(path="/data/2.3/2006", pattern="returns",
> full.names=T,recursive=T)  .... Each file is a bunch of returns for a
> particular date (unique). There are like 252 files or so.
>
> With a custom function myread (below), I define a vector ----- res <-
> vector("list",length=length(bunchafiles)) , and read files into it ----
> res <- lapply(bunchafiles, myread)
>
> myread <- function (x) {
>  y <- read.csv(x, as.is=T, header=T)
>  if (nrow(y) > 0) {
>    quotedate <-
> strsplit(strsplit(x,"/",fixed=T)[[1]][11],".",fixed=T)[[1]][1]
>    a <- rep(quotedate, nrow(y))
>    y <- zoo(y,a)
>  }
>  return(y)
> }
>
> I now have a list of zoo'd files. Each of them is indexed by a date
> which is unique. All fine so far.
>
> Now, I want to combine all of these into one large zoo object. So I say
> ------  bigzoo <- do.call(rbind, res)
>
> I now get an error .... "rbind(...): indexes overlap"... I am now
> wondering how? Because when I do the foll -----  for (i in
> 1:length(res)) {cat(i," ",unique(index(res[i][[1]])),"\n")}
> I see that I have unique indexes for each res.... So why is rbind
> behaving thus?
> --------------------------------------------------------
>
> This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing.
> --------------------------------------------------------
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>




More information about the R-help mailing list