title: R Shiny colour code table row depending on cell contents
body: <p>I am trying to colour code each row of a table depending on what data is in column 2. See picture below.</p>
  
  <p><a href="https://i.stack.imgur.com/00ZqI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/00ZqI.png" alt="enter image description here"></a></p>
  
  <p>Basically to give you an example, the code needs to work dependent on column two, so if it says Sub-Saharan Africa for example, make the whole row a certain colour, same for Latin America and the Carribean but with a different colour. There are a few other columns to the right of the Region column. I think I might need a number of if statements in the dataTable function which is below but any help would be appreciated.</p>
  
  <pre><code>  output$Composite &lt;- renderDataTable(datatable(FVI_DATA_COMPOSITE, 
                                                  options = list(
                                                  columnDefs = list(list(className = 'dt-center', targets = 3:9)))) 
                                                  %&gt;% formatRound(c(3:9), 2))
  </code></pre>
  
  <p>Edit: New code block that does not work currently.</p>
  
  <pre><code> output$Composite &lt;- renderDataTable(datatable(FVI_DATA_COMPOSITE, 
                                                  options = list(
                                                  columnDefs = list(list(className = 'dt-center', targets = 3:9)), pageLength = 50, lengthChange = FALSE))  
                                                  %&gt;% formatRound(c(3:9), 2))
                                                  %&gt;% formatStyle(0, target = "row", 
                                                  backgroundColor = styleEqual(which(FVI_DATA_COMPOSITE$Region == "Sub-Saharan Africa")[1], "red"))
  </code></pre>