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
@@ -133,6 +133,8 @@
133
133
# 2: 3
134
134
```
135
135
136
+
24.`DT[, head(.SD,n), by=grp]`and`tail`arenowoptimizedwhen`n>1`, [#5060](https://github.com/Rdatatable/data.table/issues/5060) [#523](https://github.com/Rdatatable/data.table/issues/523#issuecomment-162934391). `n==1` was already optimized. Thanks to Jan Gorecki and Michael Young for requesting, and Benjamin Schwendinger for the PR.
137
+
136
138
## BUG FIXES
137
139
138
140
1.`by=.EACHI`when`i`iskeyedbut`on=`differentcolumnsthan`i`'s key could create an invalidly keyed result, [#4603](https://github.com/Rdatatable/data.table/issues/4603) [#4911](https://github.com/Rdatatable/data.table/issues/4911). Thanks to @myoung3 and @adamaltmejd for reporting, and @ColeMiller1 for the PR. An invalid key is where a `data.table` is marked as sorted by the key columns but the data is not sorted by those columns, leading to incorrect results from subsequent queries.
error(_("Type '%s' not supported by GForce head/tail/first/last/`[`. Either add the prefix utils::head(.) or turn off GForce optimization using options(datatable.optimize=1)"), type2char(TYPEOF(x)));
if (!isInteger(valArg) ||LENGTH(valArg)!=1||INTEGER(valArg)[0]!=1) error(_("Internal error, gtail is only implemented for n=1. This should have been caught before. please report to data.table issue tracker.")); // # nocov
996
-
returngfirstlast(x, false, 1);
985
+
SEXPgtail(SEXPx, SEXPnArg) {
986
+
if (!isInteger(nArg) ||LENGTH(nArg)!=1||INTEGER(nArg)[0]<1) error(_("Internal error, gtail is only implemented for n>0. This should have been caught before. please report to data.table issue tracker.")); // # nocov
987
+
constintn=INTEGER(nArg)[0];
988
+
returnn==1 ? glast(x) : gfirstlast(x, false, n, true);
997
989
}
998
990
999
-
SEXPghead(SEXPx, SEXPvalArg) {
1000
-
if (!isInteger(valArg) ||LENGTH(valArg)!=1||INTEGER(valArg)[0]!=1) error(_("Internal error, ghead is only implemented for n=1. This should have been caught before. please report to data.table issue tracker.")); // # nocov
1001
-
returngfirstlast(x, true, 1);
991
+
SEXPghead(SEXPx, SEXPnArg) {
992
+
if (!isInteger(nArg) ||LENGTH(nArg)!=1||INTEGER(nArg)[0]<1) error(_("Internal error, gtail is only implemented for n>0. This should have been caught before. please report to data.table issue tracker.")); // # nocov
993
+
constintn=INTEGER(nArg)[0];
994
+
returnn==1 ? gfirst(x) : gfirstlast(x, true, n, true);
1002
995
}
1003
996
1004
-
SEXPgnthvalue(SEXPx, SEXPvalArg) {
1005
-
if (!isInteger(valArg) ||LENGTH(valArg)!=1||INTEGER(valArg)[0]<=0) error(_("Internal error, `g[` (gnthvalue) is only implemented single value subsets with positive index, e.g., .SD[2]. This should have been caught before. please report to data.table issue tracker.")); // # nocov
1006
-
returngfirstlast(x, true, INTEGER(valArg)[0]);
997
+
SEXPgnthvalue(SEXPx, SEXPnArg) {
998
+
if (!isInteger(nArg) ||LENGTH(nArg)!=1||INTEGER(nArg)[0]<1) error(_("Internal error, `g[` (gnthvalue) is only implemented single value subsets with positive index, e.g., .SD[2]. This should have been caught before. please report to data.table issue tracker.")); // # nocov
0 commit comments