title: Map cell colors to data values in kableExtra to create a heatmap table
body: <p>I have a table below and would like to apply ROW-level heat maps.</p>
  
  <p>(1) Any idea how? Right now the heat map is the same for both values in the single row below.</p>
  
  <p>(2) Is there a way to make the header for the group column NOT be angled 90 degrees? Right now all headers are angled but for the group column it be better without angle=90.</p>
  
  <p>here is the rmd file.</p>
  
  <pre><code>---
  title: "Untitled"
  output: pdf_document
  ---
  
  ```{r setup, include=FALSE}
  knitr::opts_chunk$set(echo = TRUE)
  
  
  library(dplyr)
  library(kableExtra)
  #d = data.frame(group= c("A","b"),cat1=c(2,50),cat2=c(100,2))
  d = data.frame(group= c("A"),cat1=c(2),cat2=c(NA))
  
  d = d %&gt;%
      mutate_if(is.numeric, function(x) {
    cell_spec(x, "latex", bold = F, background = spec_color(x,option="C", begin=.5, end = 0.99))
  }) 
  
  ```
  
  
  
  ```{r table , echo= FALSE, comment = FALSE, message= FALSE, warning = FALSE, fig.height=3, fig.width = 8} 
  
  kable(
        d, format ="latex",
        caption = "",
        booktabs = T, 
        longtable = T,
        escape = F ,
        align = "c"
        ) %&gt;% kable_styling(latex_options = c(
          "striped", 
          "repeat_header"
          )
         )%&gt;% row_spec( 0,angle = 90)
  
  
  ```
  </code></pre>
  
  <p>Note: Ideally it'd be good to have this done with the kableExtra functionality so they color schemes match exactley to other kableExtra tables.</p>