Reputation: 51
I'm trying to do some cell coloring on a table evaluating the value of some columns using the formattable library :
APP code : library(shiny) library(data.table) library(DT) library(formattable)
table <- fread("C:/Users/XXXXXXX/Desktop/Classeur2.csv")
ui <- fluidPage(
titlePanel(""),
sidebarLayout(
mainPanel(
dataTableOutput("Table")
)
)
)
server <- function(input, output) {
output$Table <- renderDataTable({
formattable(Table, list(
S1 = formatter("span",
style = ~ style(color = ifelse(x >= 0, "green",
"red")))))
})
}
shinyApp(ui = ui, server = server)
Upvotes: 0
Views: 702
Reputation: 51
I found out that I need to convert the table with as.datatable()
Upvotes: 1