I have two xts-matrices (A and B) were both contain headers in the form of "value1.value2". This label combination is saved for both matrices as characters to avoid R to attach the prefix "X" to the numbers.
A and B are already labeled with their symbol combination.
Now I want to attach matrix B on the right hand-side of A (I used C <- cbind(A,B)
or C <- merge.xts(A,B)
).
Merging or binding them causes R to attach the X in front of the headers.
It can't be undone by
colnames(C) <- as.character(colnames(C))
How can I get rid of it, if I want to use numbers as headers (please note: it's not a file that I am loading, I am trying to bring to outputs together)?
As next step I want to order the columns in an increasing manner and tried:
C <- C[,sort(colnames(C), decreasing = F)]
But R completely messes up the order and seems to randomly arrange the columns.
I also tried as.data.frame(cbind(A,B))
and sort the dataframe, but it doesn't improve anything.
I am happy to receive valuable suggestions.
Unfortunately, I can't provide a minimum working example.
Thank you very much!