0

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?

Frank
  • 65,012
  • 8
  • 95
  • 173
abbas786
  • 401
  • 3
  • 10

0 Answers0