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

merge.xts segfault with empty xts object and more than 1 non-xts object #157

Closed
joshuaulrich opened this issue Oct 24, 2016 · 1 comment
Closed
Assignees
Labels

Comments

@joshuaulrich
Copy link
Owner

This appears to be caused by mergeXts attempting to set dimnames on a vector. All commands below cause a segfault. Thanks for Jeffrey Mazar for the reproducible example.

merge(xts(), 0, xts())
merge(xts(), xts(), 0)
merge(xts(), xts(), "")
@joshuaulrich joshuaulrich self-assigned this Oct 24, 2016
@joshuaulrich
Copy link
Owner Author

joshuaulrich commented Oct 25, 2016

A couple more observations:

  1. merge(xts(), 1, 1) also crashes. Seems like anything with an empty xts object will fail, except the 2-way merge: merge(xts(), 1).
  2. If the second argument (y) passed to do_merge_xts is not an xts object, it is converted to xts via the equivalent of: y_xts <- try.xts(y, length.out = length(index(x)), error = xts:::.merge.xts.scalar). In the case of merge(xts(), 0, xts()), y = 0 and length.out = 0L. So y_xts is a matrix with no rows and 1 column.
  3. The expected behavior of merge(xts(), 1, 1) is the same as merge(merge(xts(), 1), 1).

@joshuaulrich joshuaulrich changed the title merge.xts segfault with two empty xts objects and one non-xts object merge.xts segfault with empty xts object and more than 1 non-xts object Oct 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant