Home > Net >  Name the index column of a dt::datatable()
Name the index column of a dt::datatable()

Time:11-02

Is there a way to give a name to the index column of a datatable?

library(DT)
datatable(iris)

CodePudding user response:

A possible solution:

library(DT)
library(dplyr)

iris %>% 
  rownames_to_column("myid") %>% 
  datatable(iris, rownames = F)
  •  Tags:  
  • r dt
  • Related