-
-
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
reclass() changes "tclass" attribute #249
Comments
In case it helps, I have the same issue and bisecting shows it started with 50b2510 |
|
Thanks @TomAndrews, that's very helpful! |
@Eluvias can you provide more context for how you encountered this issue? If nothing else, it will help create unit tests to provide better coverage. |
I've investigated and found this is due to how the duplicated index attributes (timezone, class, format) are handled in the Note that #245 will address this by removing the An acceptable fix must handle the current behavior, until the I would greatly appreciate contributions of unit tests that pass under v0.10-2! Anyone (including future me) who wants to do some work on them should probably work from a branch created off the v0.10-2 tag. |
It was captured through unit testing. x <- ifelse(coredata(data), yes, no)
out <- reclass(x, data) |
Calls to structure() are relatively expensive, due to creation of multiple temporary copies of the data. Replace the structure() call with the logic from the ..xts() constructor.
I just left a comment on 50b2510, apologies if I'm stating the obvious. I had a quick look at setting up some unit tests but I'm afraid I'd need some slightly more idiot-proof instructions. Are you just after some tests of the output of |
Sorry my suggestion wasn't clear. A user could have specified expand.grid(tclass = c("missing", "specified"),
.indexClass = c("missing", "specified"))
# tclass .indexClass
# 1 missing missing
# 2 specified missing
# 3 missing specified
# 4 specified specified Where "specified" should be two different values (e.g. No need to run through |
I have pushed a branch on my fork which adds unit tests to the 0.10-2 tag. These all pass in 0.10-2 but there are some failures (as you'd expect) for 0.11. This doesn't merge cleanly with master but I have another branch with the tests and my attempts fixing the failures which I'll make a pull request for. |
As documented in joshuaulrich#249, v0.11 introduced changes to .xts() which altered behaviour compared to v0.10-2. As a first step to fixing this regression, this commit adds unit tests for all possible permutations for setting the index class and timezone in .xts(). The tests check accessing the class in 3 different ways: 1. Using tclass() 2. Using indexClass() 3. Checking the 'tclass' attribute on the index object Similarly the tests check accessing timezone by: 1. Using tzone() 2. Using indexTZ() 3. Checking the '.indexTZ' attribute on the index object These tests are designed to document the behaviour as of v0.10-2. As such they pass on v0.10-2 but fail for v0.11.
Reinstate the behaviour as of v0.10-2. .indexCLASS should take precedence over tclass. Fixes joshuaulrich#249.
The text was updated successfully, but these errors were encountered: