title: Selecting and colouring single table cells with kableExtra in R markdown cell_spec
body: <p>I use R markdown in combination with LaTeX to create dynamic PDF reports. To generate the summarizing tables I use the <strong>kableExtra</strong> package.</p>
  
  <p>I'd like to change the styling of individual cells.</p>
  
  <p>Example: Consider the R dataframe <code>mtcars[1:10, 1:5]</code>. Using this would be rendered into some nice table:</p>
  
  <pre><code>kable(mtcars[1:10, 1:5], format="latex", booktabs = T)` 
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/myWiR.png" alt="Rendered table"></p>
  
  <p>Now I want to change the style of certain cells. Say the 2nd and 8th entry of <em>mpg</em> should be green, the 4th and 5th of <em>disp</em> should be orange and italicized and the last four entries of <em>drat</em> should be red and bold. And the same cells should be like that, no matter which entries are in the cells.</p>
  
  <p>I'm perfectly aware of the documentation and the examples, such as row and column specific colouring. But the documentation for <em>cell_spec</em> deals only with conditional logic depending on the cell values, while I'd like to colour the cells independently.</p>