title: How can I style format some rows in a data frame depending on the input of a checkbox in a shiny app?
body: <p>I am working on a shiny app in which the user filters interactively a data frame using some widgets. One of my checkbox is called "LOT". What  this checkbox is intended to do is to colour yellow those rows in which the value of the column x_LOT or Y_LOT is "true". </p>
  
  <p>I have tried to include a conditional inside renderTable, so that if the input of the checkbox is true, the correspondent rows are coloured, but it did not work. I have tried to write the conditional inside reactive function that I have for the rest of the filters, but it did not work either.</p>
  
  <p>My code is as follows:</p>
  
  <pre><code># MY DATA FRAME
  df &lt;- data.frame(Consequence = c(rep("x",4),rep("y",4),rep("z",4)),
                   CANONICAL = rep(c("YES","NO"),6),
                   x_LOT = c(rep("False", 3), rep("True", 5), rep("False",2), "True","False"),
                   y_LOT = c(rep("False", 8), rep("True",2), rep("False",2)),
                   x3=c(12,43,64,34,93,16,32,74,84,89,45,67))
  write.csv(df, "df.csv")
  
  
  # MY APP
  library(shiny)
  library(DT)    #  for data tables
  library(dplyr)
  library(shinyWidgets)
  library(lazyeval)
  library(data.table)
  
  ui &lt;- function(request) {
    fluidPage(
      sidebarLayout(
        sidebarPanel(
          fileInput("file1", "Upload your File",multiple = FALSE,
                    accept = c("text/csv", "text/comma-separated-values,text/plain",".csv")),
          pickerInput("Consequence", "Consequence:", choices = NULL, options = list(`actions-box` = TRUE),
                      selected = NULL, multiple = TRUE ),
          prettyCheckbox(inputId = "CANONICAL", label = "CANONICAL", value = FALSE,
                         outline = TRUE, fill = TRUE, bigger = TRUE, status = 'success',width = NULL),
          prettyCheckbox(inputId="LOT", label = "LOT", value = FALSE, 
                       outline= TRUE, fill = TRUE, status = 'success', width = NULL)),
  
        mainPanel(
          dataTableOutput("contents")
        )))}
  
  server &lt;- function(input, output, session) {
  
    df &lt;- reactive({
      req(input$file1)
      df &lt;- read.csv(input$file1$datapath)
    })
  
    observeEvent(df(), {
      req(df())
      updatePickerInput(session, inputId = "Consequence", choices = levels(df()$Consequence),  selected = levels(df()$Consequence))
    })
  
  
    filtered_df &lt;- reactive({
      df() %&gt;% 
        filter( Consequence %in% input$Consequence ) %&gt;%
        filter(if (input$CANONICAL == TRUE) CANONICAL == "YES" else !is.na(CANONICAL))
    })
  
    output$contents &lt;- renderDT(
      filtered_df(),
      class = "display nowrap compact", # style
      filter = "top")
  
    # if(input$LOT == TRUE){
    #   cols = names(df())[grepl( "LOT", names(filtered_df()))]
    #   datatable(filtered_df) %&gt;% formatStyle(
    #     columns = cols,
    #     target = 'row',
    #     backgroundColor = styleEqual("TRUE", 'yellow')
    #   )}
  }
  shinyApp(ui, server)
  </code></pre>
  
  <p>So, in this case, I would expect to have the rows 4 to 11 coloured in yellow when the checkbox "LOT" is pressed. </p>
  
  <p>Thanks,</p>
  
  <p>Rachael</p>