From ff1b61d9401f420104960f45f59ffd50148fcef0 Mon Sep 17 00:00:00 2001
From: Scott Ritchie <sritchie73@gmail.com>
Date: Wed, 19 Feb 2020 15:48:55 +1100
Subject: [PATCH 1/7] Updated documentation for rbindlist(fill=TRUE)

---
 man/rbindlist.Rd | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man/rbindlist.Rd b/man/rbindlist.Rd
index 192fb5135f..ea96932b23 100644
--- a/man/rbindlist.Rd
+++ b/man/rbindlist.Rd
@@ -13,7 +13,7 @@ rbindlist(l, use.names="check", fill=FALSE, idcol=NULL)
 \arguments{
   \item{l}{ A list containing \code{data.table}, \code{data.frame} or \code{list} objects. \code{\dots} is the same but you pass the objects by name separately. }
   \item{use.names}{\code{TRUE} binds by matching column name, \code{FALSE} by position. `check` (default) warns if all items don't have the same names in the same order and then currently proceeds as if `use.names=FALSE` for backwards compatibility (\code{TRUE} in future); see news for v1.12.2.}
-  \item{fill}{\code{TRUE} fills missing columns with NAs. By default \code{FALSE}. When \code{TRUE}, \code{use.names} is set to \code{TRUE}.}
+  \item{fill}{\code{TRUE} fills missing columns with NAs, or NULL for missing list columns. By default \code{FALSE}. When \code{TRUE}, \code{use.names} is set to \code{TRUE}.}
   \item{idcol}{Creates a column in the result showing which list item those rows came from. \code{TRUE} names this column \code{".id"}. \code{idcol="file"} names this column \code{"file"}. If the input list has names, those names are the values placed in this id column, otherwise the values are an integer vector \code{1:length(l)}. See \code{examples}.}
 }
 \details{

From a839e02f0bff01c4925c4cf04805b1bd04233088 Mon Sep 17 00:00:00 2001
From: Scott Ritchie <sritchie73@gmail.com>
Date: Wed, 19 Feb 2020 15:49:08 +1100
Subject: [PATCH 2/7] Print NULL entries of list as NULL

---
 R/print.data.table.R | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/R/print.data.table.R b/R/print.data.table.R
index 31a009d5b4..80f4c8696f 100644
--- a/R/print.data.table.R
+++ b/R/print.data.table.R
@@ -141,7 +141,7 @@ format.data.table = function (x, ..., justify="none", timezone = FALSE) {
   }
   format.item = function(x) {
     if (is.null(x))  # NULL item in a list column
-      ""
+      "NULL"
     else if (is.atomic(x) || inherits(x,"formula")) # FR #2591 - format.data.table issue with columns of class "formula"
       paste(c(format(head(x, 6L), justify=justify, ...), if (length(x) > 6L) "..."), collapse=",")  # fix for #37 - format has to be added here...
     else

From 2ed3eeaaa3947e8fa66cc5aee53929664ca7dfe7 Mon Sep 17 00:00:00 2001
From: Scott Ritchie <sritchie73@gmail.com>
Date: Wed, 19 Feb 2020 15:49:19 +1100
Subject: [PATCH 3/7] Added news item

---
 NEWS.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/NEWS.md b/NEWS.md
index 71fd76aa65..4e39414d86 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -145,6 +145,7 @@ unit = "s")
 
 7. Added more explanation/examples to `?data.table` for how to use `.BY`, [#1363](https://github.com/Rdatatable/data.table/issues/1363).
 
+8. The documentation for the `fill` argument in `rbind()` and `rbindlist()` now notes the expected behaviour for missing `list` columns when `fill=TRUE`. For clarity, `NULL` entries in `list` columns are now also shown as `NULL` instead of empty when showing the contents of a data.table [#4199](https://github.com/Rdatatable/data.table/pull/4199).
 
 # data.table [v1.12.8](https://github.com/Rdatatable/data.table/milestone/15?closed=1)  (09 Dec 2019)
 

From e1188e2351c6cfcc1b03147fdea7922ba50f7d95 Mon Sep 17 00:00:00 2001
From: Michael Chirico <chiricom@google.com>
Date: Sat, 6 Jan 2024 19:12:52 -0800
Subject: [PATCH 4/7] edit NEWS, use '[NULL]' not 'NULL'

---
 NEWS.md              | 2 +-
 R/print.data.table.R | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/NEWS.md b/NEWS.md
index 7bbcac005d..437d76b6cb 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -6,7 +6,7 @@
 
 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.
 
-2. The documentation for the `fill` argument in `rbind()` and `rbindlist()` now notes the expected behaviour for missing `list` columns when `fill=TRUE`. For clarity, `NULL` entries in `list` columns are now also shown as `NULL` instead of empty when showing the contents of a data.table [#4199](https://github.com/Rdatatable/data.table/pull/4199).
+2. The documentation for the `fill` argument in `rbind()` and `rbindlist()` now notes the expected behaviour for missing `list` columns when `fill=TRUE`, namely to use `NULL` (not `NA`). For clarity, `NULL` entries in `list` columns are now also shown as `[NULL]` instead of empty when printing a data.table [#4199](https://github.com/Rdatatable/data.table/pull/4199).
 
 # data.table [v1.14.99](https://github.com/Rdatatable/data.table/milestone/29)  (in development)
 
diff --git a/R/print.data.table.R b/R/print.data.table.R
index 0c428f1d3a..6588ca458f 100644
--- a/R/print.data.table.R
+++ b/R/print.data.table.R
@@ -215,7 +215,7 @@ format_col.expression = function(x, ...) format(char.trunc(as.character(x)), ...
 
 format_list_item.default = function(x, ...) {
   if (is.null(x))  # NULL item in a list column
-    "NULL" # not '' to distinguish from that "common" string value in data
+    "[NULL]" # not '' or 'NULL' to distinguish from those "common" string values in data
   else if (is.atomic(x) || inherits(x, "formula")) # FR #2591 - format.data.table issue with columns of class "formula"
     paste(c(format(head(x, 6L), ...), if (length(x) > 6L) "..."), collapse=",") # fix for #5435 and #37 - format has to be added here...
   else if (has_format_method(x) && length(formatted<-format(x, ...))==1L) {

From 157a41b64de5a47ea918d6e75524e7166f719d3d Mon Sep 17 00:00:00 2001
From: Michael Chirico <michaelchirico4@gmail.com>
Date: Sun, 7 Jan 2024 11:33:07 +0800
Subject: [PATCH 5/7] fix test

---
 inst/tests/tests.Rraw | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/inst/tests/tests.Rraw b/inst/tests/tests.Rraw
index cb74b3109e..6a4b2a4baa 100644
--- a/inst/tests/tests.Rraw
+++ b/inst/tests/tests.Rraw
@@ -320,7 +320,7 @@ test(69.4, names(tables(silent=TRUE, mb=FALSE, index=TRUE)),
 
 xenv = new.env()   # to control testing tables()
 xenv$DT = data.table(a = 1)
-test(69.5, nrow(tables(env=xenv)), 1L, output="NAME NROW NCOL MB COLS KEY\n1:   DT    1    1  0    a.*Total: 0MB")
+test(69.5, nrow(tables(env=xenv)), 1L, output="NAME NROW NCOL MB COLS    KEY\n1:   DT    1    1  0    a [NULL]\nTotal: 0MB")
 xenv$DT = data.table(A=1:2, B=3:4, C=5:6, D=7:8, E=9:10, F=11:12, G=13:14, H=15:16, key="A,D,F,G")
 test(69.6, nrow(tables(env=xenv)), 1L, output="NAME NROW NCOL MB            COLS     KEY\n1:   DT    2    8  0 A,B,C,D,E,F,... A,D,F,G.*Total: 0MB")
 rm(xenv)

From 291d1d23c8150ba133767172c5fa409d0fb04d3d Mon Sep 17 00:00:00 2001
From: Michael Chirico <chiricom@google.com>
Date: Sat, 6 Jan 2024 19:40:58 -0800
Subject: [PATCH 6/7] split NEWS item

---
 NEWS.md | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/NEWS.md b/NEWS.md
index 437d76b6cb..e82e8c4d4e 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,11 +2,15 @@
 
 # data.table [v1.15.99]() (in development)
 
+## NEW FEATURES
+
+1. `print.data.table()` shows empty (`NULL`) list column entries as `[NULL]` for emphasis. Previously they would just print nothing (empty string). Part of [#4198](https://github.com/Rdatatable/data.table/issues/4198). Thanks @sritchie73 for the proposal and fix.
+
 ## NOTES
 
 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.
 
-2. The documentation for the `fill` argument in `rbind()` and `rbindlist()` now notes the expected behaviour for missing `list` columns when `fill=TRUE`, namely to use `NULL` (not `NA`). For clarity, `NULL` entries in `list` columns are now also shown as `[NULL]` instead of empty when printing a data.table [#4199](https://github.com/Rdatatable/data.table/pull/4199).
+2. The documentation for the `fill` argument in `rbind()` and `rbindlist()` now notes the expected behaviour for missing `list` columns when `fill=TRUE`, namely to use `NULL` (not `NA`), [#4198](https://github.com/Rdatatable/data.table/pull/4198). Thanks @sritchie73 for the proposal and fix.
 
 # data.table [v1.14.99](https://github.com/Rdatatable/data.table/milestone/29)  (in development)
 

From 8e0b33498c1dbef4cdd68ba6a6a77e6acbce292f Mon Sep 17 00:00:00 2001
From: Benjamin Schwendinger <benjamin.schwendinger@tuwien.ac.at>
Date: Mon, 8 Jan 2024 00:49:33 +0100
Subject: [PATCH 7/7] add example

---
 NEWS.md | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/NEWS.md b/NEWS.md
index e82e8c4d4e..59bba9d622 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -4,7 +4,15 @@
 
 ## NEW FEATURES
 
-1. `print.data.table()` shows empty (`NULL`) list column entries as `[NULL]` for emphasis. Previously they would just print nothing (empty string). Part of [#4198](https://github.com/Rdatatable/data.table/issues/4198). Thanks @sritchie73 for the proposal and fix.
+1. `print.data.table()` shows empty (`NULL`) list column entries as `[NULL]` for emphasis. Previously they would just print nothing (same as for empty string). Part of [#4198](https://github.com/Rdatatable/data.table/issues/4198). Thanks @sritchie73 for the proposal and fix.
+
+    ```R
+    data.table(a=list(NULL, ""))
+    #         a
+    #    <list>
+    # 1: [NULL]
+    # 2:
+    ```
 
 ## NOTES
 
