title: printable table with partial bolding/italics within a cell
body: <p>I'm looking for a way to print out a table from R, but with formatting <em>within</em> a cell, like having some of the text within a cell be bold or italic. Normally I would first make the appropriate <code>data.frame</code>/<code>tibble</code> and then I'd format and print it using a package like <code>huxtable</code> or <code>kable</code>. Looking over documentation for <a href="https://hughjonesd.github.io/huxtable/huxtable.html" rel="nofollow noreferrer"><code>huxtable</code></a> or <a href="https://haozhu233.github.io/kableExtra/awesome_table_in_html.html" rel="nofollow noreferrer"><code>kableExtra</code></a>, it seems as though both packages treat formatting as properties of cells, implying that within-cell formatting is either unsupported or must be implemented some other way.</p>
  
  <p>If I was making a <code>ggplot</code>, I'd use <code>expression</code> for text formatting, e.g.
  </p>
  
  <pre class="lang-r prettyprint-override"><code>library(tidyverse)
  
  ggplot(data=mtcars) +
    ggtitle(expression(paste(bold("bold part"), " not bold part")))
  </code></pre>
  
  <p><img src="https://i.imgur.com/fNIJoop.png" alt=""></p>
  
  <p>I thought I could be clever by putting expressions into a <code>data.frame</code>, but this doesn't seem to be supported:</p>
  
  <pre class="lang-r prettyprint-override"><code>data.frame(var = c(expression(paste(bold("bold part"), "not bold part")),
                     expression(paste(bold("bold part"), "not bold part"))
  ))
  #&gt; Error in as.data.frame.default(x[[i]], optional = TRUE): cannot coerce class ""expression"" to a data.frame
  </code></pre>