Render superscript in pander table in RMarkdown

159 views Asked by At

I'm trying to render a pander table in RMarkdown that includes superscript. Here is my current RMarkdown code:

```
---
title: "My Table"
output: html_document
---

```{r packages, include = FALSE}
library(tidyverse)
library(pander)
```

```{r my_table}
my_table <- 
  data.frame(
    c("Sector 1",
      "Sector 2",
      "Sector 3"),
    c("100%",
      "29%",
      "NA"))

pander(my_table,
       col.names = c("Sector", "% Coverage"),
       split.cells = 40,
       keep.line.breaks = TRUE)
```

And here is the knit result:

enter image description here

I would like to add a superscripted letter "c" to the "NA" cell of the table, yielding an output like this:

enter image description here

1

There are 1 answers

0
Daniel_j_iii On

You are looking to use the notation $$ NA^c $$, but this only works outside of the R chunk at the moment.