drSnake193
drSnake193

Reputation: 3

How to display a grid.table with Shiny

I want to display a dataframe in a table using grid.table(myDataFrame). I need help figuring out:

This far I have the following codes

In the UI.R, inside fluidPage and fluidRow:

dataTableOutput("TauxInsertion")

And then in Server.R:

 output$TauxInsertion <- renderDataTable({
  dataDepartement()
  # TauxInsertionTable <- grid.table(dataDepartement())
  # TauxInsertionTable
  })

dataDepartement is a reactive variable that contains a dataFrame. Returning this data frame inside the renderDataTable gives me a table. But I need to be able to display the row names and add some color and style to the display. The commented part is what I have tried but doesn't display anything.

There are no significant messages in the console. I have also tried options(shiny.trace=TRUE) but to no avail.

Upvotes: 0

Views: 2353

Answers (1)

MikolajM
MikolajM

Reputation: 374

I think you have to use functions dedicated to plot. Take a look

library(shiny)
library(grid)
library(gridExtra)

ui <- fluidPage(
   plotOutput("plot")
      )   
server <- function(input, output) {  
   output$plot <- renderPlot({    
     grid.table(head(iris,3))
   })
}
shinyApp(ui = ui, server = server)

Upvotes: 3

Related Questions