title: How do you change the font family in a formattable in R?
body: <p>In a project for Data Science at my University, we've been asked to make a decision tree to model which customers are likely to respond or not respond to a campaign. One of the requirements of the task was to make a confusion matrix, which I converted to a data frame. This is the data frame that I generated.</p>
  
  <pre><code>    confusionMatrixCARTDecisionTree &lt;- data.frame("Number Predicted to Not Subscribe" = 
      c(36006, 542), "Number Predicted to Subscribe" = c(3554, 1086), 
      row.names = c("Number of Individuals that Subscribed", 
      "Number of Individuals that didn't Subscribe"));
  </code></pre>
  
  <p>I then used this code to convert it into a formattable.</p>
  
  <pre><code>    formattableConfusionMatrixCARTDecisionTree &lt;- formattable(
      confusionMatrixCARTDecisionTree, align = "c", 
      list("Predicted Number not Subscribing" = color_tile("white", "yellow"),     
      "Predicted Number Subscribing" = color_tile("yellow", "white")));
  </code></pre>
  
  <p>And then a function I found here, <a href="https://github.com/renkun-ken/formattable/issues/26" rel="nofollow noreferrer">https://github.com/renkun-ken/formattable/issues/26</a>, to put the formattable into a pdf report. However, what I'm trying to do now is to change the font family to CMU Serif of the confusion matrix so that it is consistent with the LaTeX file. I've worked out how to change the font for a column, like this:</p>
  
  <pre><code>    formattableConfusionMatrixCARTDecisionTree &lt;- 
      formattable(confusionMatrixCARTDecisionTree, list("Predicted Number not Subscribing" = 
      formatter("span", style=style("font-family" = "CMU Serif"))));
  </code></pre>
  
  <p>However, I have read through the documentation here <a href="https://cran.r-project.org/web/packages/formattable/formattable.pdf" rel="nofollow noreferrer">https://cran.r-project.org/web/packages/formattable/formattable.pdf</a> and I have searched online but I cannot find a way to change the font of the heading or the row names. If anyone had a solution to this I would be eternally grateful! I would also be extremely happy if anyone knew some code that would change the font family of the entire table.</p>
  
  <p>Note: I do understand a question relating to changing the appearance of the heading was asked here <a href="https://stackoverflow.com/questions/42070506/how-to-change-appearance-of-table-header-row-with-r-formattable-package">How to change appearance of table header row with R formattable package</a>, however, this was unanswered, and doesn't address the issue of changing the font family.</p>