XTS objects with duplicate index have X in front of all index values.

Given the following basic code.

#>
library(xts)
a <- xts(order.by = Sys.Date()-1:3,(8:10))
b <- xts(order.by = Sys.Date()-3:5,(10:12))
c = rbind(a,b)
c
           [,1]
2019-04-12   12
2019-04-13   11
2019-04-14   10
2019-04-14   10
2019-04-15    9
2019-04-16    8

View(c)
                V1
X2019.04.12	    12
X2019.04.13	    11
X2019.04.14	    10
X2019.04.14.1	10
X2019.04.15	    9
X2019.04.16	    8

The X shows up with View(c) specifically.

Similarly if I use write.csv(as.data.frame(c),"testout.csv") the output also has the X entries.

I recently updated everything. I have R 3.5.3, Rstudio 1.2.1335 and xts 0.11-2. I believe the significant change is with the latest version of Rstuio.

How can I remove the X's and keep duplicates?

Thank you.

Here's what I get when I run your code as a reprex:

library(xts)
#> Loading required package: zoo
#> 
#> Attaching package: 'zoo'
#> The following objects are masked from 'package:base':
#> 
#>     as.Date, as.Date.numeric
a <- xts(order.by = Sys.Date()-1:3,(8:10))
b <- xts(order.by = Sys.Date()-3:5,(10:12))
c = rbind(a,b)
c
#>            [,1]
#> 2019-04-12   12
#> 2019-04-13   11
#> 2019-04-14   10
#> 2019-04-14   10
#> 2019-04-15    9
#> 2019-04-16    8

Created on 2019-04-17 by the reprex package (v0.2.1)

Does this work for you in R, but not in RStudio? (see FAQ below for disambiguation)

That is a great question, but I am entirely dependent on the GUI, that is Rstuio. How to I use the RGui? Just type in the same commands?

Nevermind, I did exactly that the View(c) gives the exact same X output as does the write.csv.

It seems Rstuio itself is not the issue. How can I figure out what caused this? It did not happen before.

Thanks.

I don't know the xts package very well, hopefully someone else here has more experience with it.

Some places to take a look:

The package repo

Package NEWS from CRAN (for recent changes)
https://cran.r-project.org/web/packages/xts/NEWS

Possibly related threads on Stack Overflow:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.