I want to subset some rows of a data table. Like this:
# load data
data("mtcars")
# convert to data table
setDT(mtcars,keep.rownames = T)
# Subset data
mtcars <- mtcars[like(rn,"Mer"),] # or
mtcars <- mtcars[mpg > 20,]
However, I'm working with a huge data set and I wanted to avoid using <-
, which is not memory efficient because it makes a copy of the data.
Is this correct?
Is it possible to update the filtered data without <-
?