Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turn on row names in renderDataTable

Tags:

r

shiny

I am displaying a table in Shiny and want to use renderDataTable but it is not displaying the row names which are important to me. renderTable displays the row names fine but does not look as nice.

I have:

 output$tab<-renderDataTable({tabplot()})

and have tried:

output$tab<-renderDataTable({tabplot()}, include.rownames=TRUE)

with no luck.

like image 719
mike Avatar asked Dec 24 '22 06:12

mike


1 Answers

Try this, it works for me, although I can't fully reproduce your dataset.

    output$tab <- DT::renderDataTable({
        datatable( tabplot(), rownames = TRUE )
    })

I've forced the use of the DT package, and also enclosed the table creation in a "datatable" call, which includes the option to enable rownames. I think you'd also be able to enable that option in the creation of "tablplot()", but it should definitely work here either way.

like image 87
rosscova Avatar answered Dec 26 '22 21:12

rosscova