我正在尝试将data.frame插入到rShiny中的renderDataTable对象中。我的data.frame填充没有任何问题:
然而,我闪亮的仪表板出错并且没有阅读表格,尽管它填充了。
我无法共享数据,因为数据是私有的,但是我希望你能帮我理解闪亮的概述,以帮助我理解我的问题。
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'))
)
)
我已经尝试将观察变为反应函数。但我仍然没有看到任何结果。
df.table <- reactive({
filtered.df <- MetricsDataFrame[MetricsDataFrame$test == input$test,]
filtered.df[5, (3:8)] <- colSums(filtered.df[,3:8])
})