[R] zoo merge() method

Achim Zeileis Achim.Zeileis at wu-wien.ac.at
Thu Apr 12 18:42:04 CEST 2007


On Thu, 12 Apr 2007 Matthew.Findley at ch2m.com wrote:

> attempted to get at this by merging the two time series (by union),
> interpolating the NAs, and finally, subtracting one vector from the
> other.  The problem is that I can not combine the two zoo time series
> objects using the merge() or cbind() functions.  I get the following
> error:
>
> Error in z[match0(index(a), indexes), ] <- a[match0(indexes, index(a))]
> :
>         number of items to replace is not a multiple of replacement
> length

Usually, problems like this occur when the time stamps in one of your time
series are not unique. Maybe we should improve the error message by
explicitely trying to catch this error.

You can easily check this, e.g., via
  any(table(time(zoo_object)) > 1)

> The input/output from a recent R Console session might help,

Not really, the data itself would have been much more helpful...and even
better some simplified artificial data set.

hth,
Z



More information about the R-help mailing list