joshuaulrich / xts

Extensible time series class that provides uniform handling of many R time series classes by extending zoo.
http://joshuaulrich.github.io/xts/
GNU General Public License v2.0
220 stars 71 forks source link

Merging only zero-width xts objects returns a zero-length result #227

Closed joshuaulrich closed 1 year ago

joshuaulrich commented 6 years ago

merge.xts() returns a completely empty xts object if you merge only empty objects. merge.zoo() returns a zero-width object with the appropriate index values.

> merge(.xts(,1:3), .xts(,2:4))  # index is empty
Data:
numeric(0)

Index:
integer(0)
> merge(zoo(,1:3), zoo(,2:4))  # index is merged
Data:
numeric(0)

Index:
[1] 1 2 3 4
> merge(.xts(,1:3), .xts(,2:4), .xts(,0:2))   # index is empty
Data:
numeric(0)

Index:
integer(0)
> merge(zoo(,1:3), zoo(,2:4), zoo(,0:2))    # index is merged
Data:
numeric(0)

Index:
[1] 0 1 2 3 4