-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Labels
Milestone
Description
The following snippet produces what it should, i.e. a list column axis with NULL values.
library(data.table) # v1.18.0
dt1 <- data.table(var_name = c("foo", "bar"))
dt1[, axis := lapply(var_name, \(v) NULL)]
But if the table happens to contain a single row, it attempts to remove the column instead, i.e. it behaves like dt2[, axis := NULL] would.
dt2 <- data.table(var_name = c("foo"))
dt2[, axis := lapply(var_name, \(v) NULL)]