Added [<-.IDate so that rbind.data.frame retains integer IDate#3602
Added [<-.IDate so that rbind.data.frame retains integer IDate#3602
Conversation
9873c64 to
6c0dd54
Compare
|
Josh Ulrich replied on r-devel, misunderstanding was pretty simple -- So the approach here seems correct. |
There was a problem hiding this comment.
Wow, the level of deja vu on reading this:
It seems that the .Internal rbind of two data.frame coerces IDate to numeric. Tried defining "[<-.IDate" as per Tom's suggestion, and c.IDate to no avail (maybe because the .Internal code in bind.c doesn't look up package methods?)
In fact I went through the same existential crisis for a while this morning! I'm not sure what was tried for [<-.IDate back then, maybe the NextMethod approach? I tried that as well but it seems fundamentally doomed because ... in NextMethod can't be passed as origin to the as.Date call in [<-.Date, which is needed if we pass the underlying integer to [<-.Date as value. If we pass an IDate, the #2008 problem happens -- double with IDate class. I didn't try running as.Date(value) but that would mean coercing numeric just to get [<-.Date and then back to integer aftewards... seems silly.
Anyway I think we can change this test that was testing that a bug was still a bug. Now the bug is fixed. I'm not sure if the subsequent test is still needed, but it can't hurt.
b933b9d to
58cbf3c
Compare
Codecov Report
@@ Coverage Diff @@
## master #3602 +/- ##
==========================================
+ Coverage 97.81% 97.81% +<.01%
==========================================
Files 66 66
Lines 12909 12915 +6
==========================================
+ Hits 12627 12633 +6
Misses 282 282
Continue to review full report at Codecov.
|
0bbdea3 to
9ed60ce
Compare
Closes #2008
I still don't really understand why these changes are necessary (and both are in fact necessary).
I posted this on r-devel, might be some insight there: https://stat.ethz.ch/pipermail/r-devel/2019-May/077866.html