If I use cbind to merge two matrices or data.frames that have the same colnames those colnames stay the same in the new matrix or data.frame:
df <- data.frame(test = c(1,2))
df.merge <- cbind(df,df)
df.merge
test test
1 1 1
2 2 2
However, if I do the same with an xts object, a numerical value is added to the colnames:
df.xts <- xts(df, order.by = as.POSIXct(c("2019-02-18 13:00","2019-02-18 14:00"), tz = "UTC"))
df.xts.merge <- cbind(df.xts, df.xts)
df.xts.merge
test test.1
2019-02-18 13:00:00 1 1
2019-02-18 14:00:00 2 2
Is there a way to prevent renaming of the columns by merging xts objects?