Interactive tables

In the preceding example application, we saw how to make our plot interactive. Now it's time to make tables interactive. Interactive plots mean we can have freedom in selecting rows/columns/cells and shorting columns.

DT is a package with DT library that helps us to make tables more interactive. Let's see a small client-side example of Data Tables with Shiny:

library(shiny) 
library(DT) 
shinyApp( 
  ui = fluidPage(DTOutput('tbl')), 
  server = function(input, output) { 
    output$tbl = renderDT( 
      iris, options = list(lengthChange = FALSE) 
    ) 
}) 

In the preceding code, DTOutput() is for outputting the table on UI, and on the server side we have used renderDT() to send the data into the UI from the iris dataset. The output can be seen ...

Get Web Application Development with R Using Shiny - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.