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
219 stars 70 forks source link

0.13.0 cannot read large multi-column xts' it created #395

Closed Gillis closed 1 year ago

Gillis commented 1 year ago

broken_xts.zip

Description

xts 0.13.0 unable to read certain xts multi column objects it produces. I upgraded from xts 0.12.1 to 0.13.0 and the code base i have starts crashing. Upon inspection, i notice certain large xts multi column structures lacking named columns created by the code produce errors when accessed in any way. When saving these 0.13.0 structures and loading them up in 0.12.1, they work as expected. Giving all the columns names also "repairs" these structures under 0.13.0.

Expected behavior

Typical xts behavior, for instance print(xts) should print the xts. xts <- xts*xts; should square the values.

However, any sort of operation on this xts leads to the error

print(test) Error in dimnames(x) <- dn : length of 'dimnames' [2] not equal to array extent

Minimal, reproducible example

based on the attached and zipped xts object inside an RDS

test <- loadRDS("broken_xts.RDS");
print(tail(test,1))
[broken_xts.zip](https://github.com/joshuaulrich/xts/files/10934787/broken_xts.zip)

Session Info

> sessionInfo()
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows Server x64 (build 14393)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] xts_0.13.0 zoo_1.8-11

loaded via a namespace (and not attached):
[1] compiler_4.2.2  tools_4.2.2     grid_4.2.2      lattice_0.20-45
joshuaulrich commented 1 year ago

Thanks for the report! I can replicate and will fix.

joshuaulrich commented 1 year ago

Fixed in the 'main' branch now and will be in the next release. Thanks again for the report!