I'm looking to perform an operation on a data table, which has column and row names defined, but then preserve those row names afterwards. For example
library(data.table)
dt <- data.table(rnorm(26))
rownames(dt) <- LETTERS
names(dt) <- "Scores"
dt[abs(Scores) < 2*sd(Scores)]
View(dt)
You can see that after that last operation, the row names are no longer the letters, but just numbered. How can I preserve the row names afterwards, so I know which ones are removed?