[R-SIG-Finance] A zoo question: what does this warning mean?

Achim Zeileis Achim.Zeileis at uibk.ac.at
Mon Apr 19 02:23:01 CEST 2010


On Mon, 19 Apr 2010, Ajay Shah wrote:

> I'm producing a zoo object through a for loop which repeatedly cbinds
> one more object to a main object X:
>
>  X <- NULL
>  for (i in 1:100) {
>    X <- cbind(X, make.a.column(i))
>  }
>
> Everything seems to be fine. But when the loop finishes, I get this error:
>
>  In merge.zoo(..., all = all, fill = fill, suffixes = suffixes, retclass = "zoo") :
>    length of suffixes and does not match number of merged objects
>
> What does this mean? Should I be worried?

It is because you initialize with

   X <- NULL

In fact, I'm surprised that this works at all because you're doing

   cbind(NULL, zoo_object)

and I didn't expect the dispatch to work correctly. Simply replace the 
initialization with

   X <- zoo(,)

then it should work correctly.

Best,
Z

> -- 
> Ajay Shah                                      http://www.mayin.org/ajayshah
> ajayshah at mayin.org                             http://ajayshahblog.blogspot.com
> <*(:-? - wizard who doesn't know the answer.
>
> _______________________________________________
> 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.
> -- Also note that this is not the r-help list where general R questions should go.
>



More information about the R-SIG-Finance mailing list