How to colour tables in R - Conditional Fomatting : <p>I want to assign colors to tables in R.</p>

<p><a href="https://i.stack.imgur.com/YjF3r.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YjF3r.png" alt="enter image description here"></a></p>

<p>Is it possible to create a table like this in R - where the predicted class is colored green when it is green and red when it is red.</p>

<p>The above table displayed is done in excel.</p>
