I am new to R so please spare me. I have a table and I would like to include up and down arrows in one column. I intend to construct a data.frame with one column exclusively up or down arrows. I can print an up arrow using & # 8 6 7 9 ; which yields ⇧ and I can print a down arrow using & # 8 6 8 1 ; which yields ⇩. How cool! However, how can I put this into my data.table in Rmardown? Additionally, any ideas on how I can paste superscripted characters in a column? (I'm using knitr to pdf in RMardown)
This is a solution with kableExtra
.
.Rmd
file:
---
title: "Untitled"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(tidyverse)
library(kableExtra)
```
```{r}
mtcars[1:4, 1:4] %>%
mutate(arrows = c("$\\uparrow$", "$\\downarrow$", "$\\rightarrow$", "$\\leftarrow$")) %>% # you can use LaTeX code here (just place it like this: "$\LaTeXcode$") %>%
mutate(superscript = c("$Example^{test}$", "$R^2$", "$R^2$", "$R^2$")) %>%
kbl(booktabs = T, linesep = "", escape = F)
```
-output
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With