You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: NEWS.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -622,6 +622,8 @@
622
622
623
623
53.`as.data.frame(DT, row.names=)`nolongersilentlyignores`row.names`, [#5319](https://github.com/Rdatatable/data.table/issues/5319). Thanks to @dereckdemezquita for the fix and PR, and @ben-schwen for guidance.
624
624
625
+
54.Anemptyresultinonecolumnbygroupwouldbecorrectlyfilledwith`NA`withwarning:`Item <n> of j's result for group <n> is zero length. This will be filled with <n> NAs to match the longest column in this result. Later groups may have a similar problem but only the first is reported to save filling the warning buffer.`However, thiswasnottruefortype`list`wherethefillvaluewas`NULL`.Emptylistresultsarenowfilledwith`NA`.
626
+
625
627
## NOTES
626
628
627
629
1. New feature 29 in v1.12.4 (Oct 2019) introduced zero-copy coercion. Our thinking is that requiring you to get the type right in the case of `0` (type double) vs `0L` (type integer) is too inconvenient for you the user. So such coercions happen in `data.table` automatically without warning. Thanks to zero-copy coercion there is no speed penalty, even when calling `set()` many times in a loop, so there's no speed penalty to warn you about either. However, we believe that assigning a character value such as `"2"` into an integer column is more likely to be a user mistake that you would like to be warned about. The type difference (character vs integer) may be the only clue that you have selected the wrong column, or typed the wrong variable to be assigned to that column. For this reason we view character to numeric-like coercion differently and will warn about it. If it is correct, then the warning is intended to nudge you to wrap the RHS with `as.<type>()` so that it is clear to readers of your code that a coercion from character to that type is intended. For example :
# TO DO: setkey could mark the key whether it is unique or not.
1923
1888
if (!is.null(lhs)) {
1924
1889
if (GForce) { # GForce should work with := #1414
1925
-
vlen= length(ans[[1L]])
1890
+
vlen= length(ans[[1L]])# TODO: this might be ngrp when na.rm=TRUE and one group has 2 and another 0, so needs enhancing here (by passing all-1 back from gans?)
1926
1891
# replicate vals if GForce returns 1 value per group
1927
-
jvals=if (vlen==length(len__)) lapply(tail(ans, -length(g)), rep, times=len__) else tail(ans, -length(g)) # see comment in #4245 for why rep instead of rep.int
1892
+
jvals=if (vlen==length(len__)) lapply(tail(ans, -length(grpcols)), rep, times=len__) else tail(ans, -length(grpcols)) # see comment in #4245 for why rep instead of rep.int
warning(_("Item %d of j's result for group %d is zero length. This will be filled with %d NAs to match the longest column in this result. Later groups may have a similar problem but only the first is reported to save filling the warning buffer."), j+1, i+1, maxn);
0 commit comments