Skip to content

Commit 3ab49af

Browse files
Extend NEWS with some examples
1 parent 05fc065 commit 3ab49af

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

NEWS.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,25 @@
6464
6565
9. In `DT[,j,by]`, `by` retains its attributes (e.g. class) when `j` is GForce optimized, [#5567](https://github.com/Rdatatable/data.table/issues/5567). Thanks to @danwwilson for the report, and @ben-schwen for the PR.
6666
67+
10. Assigning `list(NULL)` to a list column now replaces the column with `list(NULL)`, instead of deleting the column [#5558](https://github.com/Rdatatable/data.table/issues/5558). This behavior is now consistent with base `data.frame`. Thanks @tdhock for the report and @joshhwuu for the fix. This is due to a fundamental ambiguity from both allowing list columns _and_ making the use of `list()` to wrap `j=` arguments optional. We think that the code behaves as expected in all cases now. See the below for some illustration:
68+
69+
```r
70+
DT = data.table(L=list(1L), i=2L, c='a')
71+
DT[, i := NULL] # delete i
72+
DT[, L := NULL] # delete L
73+
74+
DT[, i := list(NULL)] # delete i
75+
DT[, L := list(NULL)] # assignment: identical(DT$L, list(NULL))
76+
77+
DT[, i := .(3L)] # assignment: identical(DT$i, 3L)
78+
DT[, L := .(list(NULL))] # assignment: identical(DT$L, list(NULL))
79+
80+
DT[, c('L', 'i') := list(NULL, NULL)] # delete L,i
81+
DT[, c('L', 'i') := list(list(NULL), 3L)] # assignment: identical(DT$L, list(NULL)), identical(DT$i, 3L)
82+
DT[, c('L', 'i') := list(NULL, 3L)] # delete L, assign to i
83+
DT[, c('L', 'i') := list(list(NULL), NULL)] # assign to L, delete i
84+
```
85+
6786
## NOTES
6887
6988
1. `transform` method for data.table sped up substantially when creating new columns on large tables. Thanks to @OfekShilon for the report and PR. The implemented solution was proposed by @ColeMiller1.
@@ -100,8 +119,6 @@
100119

101120
16. `print.data.table` gains new argument `show.indices` and option `datatable.show.indices` that allows the user to print a `data.table`'s indices as columns without having to modify the `data.table` itself. Thanks @MichaelChirico for the report and @joshhwuu for the PR.
102121
103-
17. Assigning `list(NULL)` to a list column now replaces the column with `list(NULL)`, instead of deleting the column [#5558](https://github.com/Rdatatable/data.table/issues/5558). This behavior is now consistent with base `data.frame`. Thanks @tdhock for the report and @joshhwuu for the fix.
104-
105122
## TRANSLATIONS
106123
107124
1. Fix a typo in a Mandarin translation of an error message that was hiding the actual error message, [#6172](https://github.com/Rdatatable/data.table/issues/6172). Thanks @trafficfan for the report and @MichaelChirico for the fix.

0 commit comments

Comments
 (0)