我想在shiny
应用程序中,当datatable第二列的每个单元格的值等于dataframe第三列同一行的单元格的值时,更改其背景色。
## app.R ##
library(shiny)
library(shinydashboard)
library(DT)
comp<-structure(list(Source = c("dates1", "dates2", "dates3", "dates4",
"dates5", "dates6", "dates7"), Counts = c(12L, 15L, 17L, 10L,
12L, 7L, 9L), Comparison = c(15, 15, 15, 15, 15, 15, 15), Difference = c(3,
0, -2, 5, 3, 8, 6)), row.names = c(NA, -7L), class = "data.frame")
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody(
datatableOutput("table")
)
)
server <- function(input, output) {
output$table<-renderDataTable({
datatable(comp)
})
}
shinyApp(ui, server)
1条答案
按热度按时间dffbzjpn1#