title: R Shiny DT Formatting Columns Based on Values
body: <p>I'm trying to format the output of multiple columns based on another column.</p>
  
  <p>In the example below I want to format Col1/2/3/4 based on their values in comparison to the value in the column 'Argu'.</p>
  
  <p>i.e.<br>
  - if Col1, Row1 is less than 7 mark Red, if not Green.<br>
  - if Col1, Row2 is less than 6 mark Red, if not Green.<br>
  - if Col1, Row3 is less than 7 mark Red, if not Green.<br>
  - if Col2, Row1 is less than 7 mark Red, if not Green.<br>
  - if Col2, Row2 is less than 6 mark Red, if not Green.<br>
  - if Col2, Row3 is less than 7 mark Red, if not Green.</p>
  
  <p>etc.</p>
  
  <p>I know is straightforward to format one column based on another column by explicitly calling out that value but for changeable argument values between rows this does not work</p>
  
  <pre><code># Load Packages
  library(shiny)
  library(DT)
  
  # Create DT
  Col1 = c(9,5,8)
  Col2 = c(9,4,7)
  Col3 = c(9,9,5)
  Col4 = c(8,8,7)
  Argu = c(7,6,7)
  df = data.frame(Col1,Col2,Col3,Col4,Argu)
  
  # Create Shiny Output
  shinyApp(
    ui = 
        navbarPage("Testing",dataTableOutput('dt')),
  
    server = function(input, output, session) {
  
      output$dt = DT::renderDataTable(datatable(df)
      %&gt;% formatStyle("Col1","Argu", backgroundColor = styleInterval(6.1,
  c("Red","Green")))
  
    )}
   )
  </code></pre>
  
  <p>Any help would be appreciated!</p>