-
-
Notifications
You must be signed in to change notification settings - Fork 71
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 character 2nd subsetting a zero-width xts returns integer(0) instead of Date of length 0 #255
Comments
Please do not open a new issue to discuss a solution proposed in another issue. That splits the discussion into multiple places, which makes it harder to keep track of the relevant details. |
This issue is a different problem than what is in The problem presented in this issue is the following
> str(testxts['2020']['2021'])
An 'xts' object of zero-width
# but index(.) should be 'Date of length 0'
> index(testxts['2020']['2021'])
integer(0) So, this issue, presents two(2) one line fixes( replace->by) (replace->by) |
My apologies. It wasn't clear to me that this issue did not depend on the suggested solution in the other issue you referenced. I deleted the comments about the other issue from your initial post, so others (including future me) aren't confused by them. |
Note that this behavior is consistent with v0.10-2: library(xts)
packageVersion("xts")
# [1] '0.10.2'
testxts <- xts(1, as.Date("2018-07-18"))
index(testxts["2020"])
# Date of length 0
index(testxts["2020"]["2020"])
# integer(0) |
I consider this a feature request, since the current behavior is consistent with v0.10-2. That makes this a lower priority than the bugs caused by regressions in v0.11-0. |
Hello,
Given a a zero-width xts, xts character 2nd subsetting returns integer(0) instead of Date of length 0. For example:
Maybe a solution is this
In xts/R/index.R
So now this works
So now all of these cases work
The text was updated successfully, but these errors were encountered: