Background:
I'm trying to insert a data.frame into a renderDataTable object in rShiny. My data.frame populates without any problems:
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])
})