0

Background:

I'm trying to insert a data.frame into a renderDataTable object in rShiny. My data.frame populates without any problems:

data.frame

However, my shiny dashboard is erroring out and not reading the table, despite the fact that it populates.

I cannot share the data as the data is private, however I was hoping you can assist me in the overview of shiny to help me understand my problem.

Code:

observe({
 filtered.df <- MetricsDataFrame[MetricsDataFrame$test == input$test,]
 filtered.df[5, (3:8)] <- colSums(filtered.df[,3:8])
 })

output$test_table <- DT::renderDataTable(

     filtered.df %>%

 DT::datatable(
      options = list(
           dom = 't',
           digits = 0,
           rownames = FALSE
      )
 ) %>%
 DT::formatCurrency(
      columns = cols,
      currency = "$"
 ) %>%
 DT::formatRound(
      columns = cols,
      digits = 0
 ) %>%
 DT::formatStyle(
      columns = cols,
      color = DT::styleInterval(0, c('red', 'green')) #,
 #      #backgroundColor = styleInterval(3.4, c('gray', 'yellow'))
  )

)

EDITS:

I have tried changing the observe into a reactive function. But I am still not seeing any results.

df.table <- reactive({
 filtered.df <- MetricsDataFrame[MetricsDataFrame$test == input$test,]
 filtered.df[5, (3:8)] <- colSums(filtered.df[,3:8])

})

datanalyst
  • 351
  • 1
  • 3
  • 15
  • @J0ki the return is unnecessary - however, I did try your suggestion and I am still in the same position; it did not work. – datanalyst Apr 05 '18 at 14:31
  • When asking for help, you should include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Apr 05 '18 at 15:31

0 Answers0