0
votes

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

  • what output* and render* functions to use with shiny
  • what to write exactly in the render* function body

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.

1

1 Answers

3
votes

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)