I'm trying to figure out if I can sort rows in a data.table
rendered with the DT
package in alphanumeric order. I've searched for previous examples but, it seems like there is no way to do that. Can anyone help lead me to the right direction?
It is possible. The way you want to do it depends on wether you want to order your datastructure (1.) or whether you want to just sort the rendered output of your datatable()
call (2.).
option
settings of your datatable()
call as explained here https://rstudio.github.io/DT/options.htmlA small example from the source above. Sort the table by columns 2 (ascending) and 4 (descending):
datatable(head(mtcars, 30), options = list(
order = list(list(2, 'asc'), list(4, 'desc'))
))