0

I don't want to reassign the subsetted table with assign() or <- operator.

in classical way, I'll do this;

library(data.table)

iris2 <- iris

setDT(iris2)

iris2 <- iris2[Sepal.Width < 5,]

but if I prefer reassigning the table it takes too much from my memory, is there an option like one of the column dropping options (iris2[,Sepal.Width := NULL]) ?

Waldi
  • 39,242
  • 6
  • 30
  • 78
Samet Sökel
  • 2,515
  • 6
  • 21
  • 4
    This is an open request : https://github.com/Rdatatable/data.table/issues/635 – Waldi Feb 12 '22 at 23:13
  • I'm closing as a dupe but adding that I also really want this feature. That issue has been open since 2014, and `data.table`-maintainers intentionally do not move fast with new features that could easily completely break backward-compatibility. For instance, can you imagine how past use-cases that (unsafely) assume `iris2[Sepal.Width < 5,]` effectively leaves the original data untouched would completely break when the data is irrevocably altered in-place? I suspect that, if/when approved, it'll need explicit nomenclature to avoid this problem. – r2evans Feb 15 '22 at 17:05

0 Answers0