Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.xts creates object with rownames #298

joshuaulrich opened this issue May 25, 2019 · 1 comment

.xts creates object with rownames #298

joshuaulrich opened this issue May 25, 2019 · 1 comment


Copy link

joshuaulrich commented May 25, 2019

.xts() will create an xts object with row names if x has rownames. For example:

m <- matrix(1, dimnames = list("a", "b"))
x <- .xts(m, 1)
# [1] "a"
y <- xts(m, .POSIXct(1))

This is a bug because xts objects should never have rownames.

@joshuaulrich joshuaulrich self-assigned this May 25, 2019
@joshuaulrich joshuaulrich added this to the 0.12-1 milestone Aug 2, 2020
Copy link
Owner Author

joshuaulrich commented Aug 2, 2020

This broke several other unit tests... because I was bad and only ran the one file.

@joshuaulrich joshuaulrich reopened this Aug 2, 2020
joshuaulrich added a commit that referenced this issue Aug 8, 2020
Setting .ROWNAMES caused some fts tests to fail because reclass()
called rownames<- on the xts object before calling re.fts(). And xts
objects can't have rownames, so the call was ignored and the reclassed
fts object didn't have rownames like the object).

For reasons I don't understand, this call did not work.
    dimnames(xx)[[1]] <- NULL
It looks like it may be a bug in R...?

After those two changes, calls to Ops.xts() for '&' failed when it was
called on an xts object and a matrix with row names. This was because
.xts() was called on the result of the operation ('e') and 'e' had
rownames because the matrix did. Now we drop dimnames before
potentially calling .xts().

Fixes #298 (maybe)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

1 participant