.Last.updated value after :=, closes #1885#3460
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3460 +/- ##
==========================================
+ Coverage 95.17% 95.17% +<.01%
==========================================
Files 65 65
Lines 12298 12302 +4
==========================================
+ Hits 11705 11709 +4
Misses 593 593
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #3460 +/- ##
==========================================
+ Coverage 97.01% 97.01% +<.01%
==========================================
Files 66 66
Lines 12475 12484 +9
==========================================
+ Hits 12102 12111 +9
Misses 373 373
Continue to review full report at Codecov.
|
|
Good idea. Would be nice to have this. |
36b6eef to
9c377fa
Compare
|
I pushed new version, using C and writing variable in data.table namespace. |
|
No manual entry? |
|
Good catch. Could be added to |
|
I remember I made manual, but it seems I was just using |
|
I guess this means that |
| @@ -1,5 +1,7 @@ | |||
| # nocov start | |||
|
|
|||
| .Last.updated <- vector("integer", 1L) # exported variable; number of rows updated by the last := or set(), #1885 | |||
There was a problem hiding this comment.
This means the initial value (even if data.table is not loaded) is 0L, is that preferable to NA_integer_?
library(data.table)
.Last.updated
# [1] 0
DT = data.table(a = 1)
DT[FALSE, a := 2]
.Last.updated
# [1] 0
Conceptually, I think .Last.updated is different in the two cases?
|
Is there any benefit to having a |
|
We need to add the same note as #2837 alongside the |
|
I don't think we need to worry about consistency on first time use, before any update. And yes, good point about duplicates on assignment, will add together with manual |
Closes #1885
Now resolved:
but adds extra overhead ofsum(!is.na(irows)), so should not be merged. Most likely changes needs to be pushed to C code where the actual updated number of rows is established. Not doing it now to avoid merge conflicts with rbindlist rework branch