Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

Math symbols in gridExtra table column headers

$
0
0

I need to write the greater or equal than math symbol on two of my column headers and printing a gridExtra table but can't make it work. Below is a small Rmarkdown document showing what I am trying to do. I am still using gridExtra 0.9.1 because all of my tables work nicely with this version.

---
title: "Math symbols in column headers"
date: "January 15, 2020"
output: pdf_document
---

```{r}
library(gridExtra)    
a <- structure(list(MLE = c(0.0839, 0.2082, 0.4194, 0.8237, 1.6201),
                    MME = c(0.0839, 0.2082, 0.4194, 0.8234, 1.6147)),
               class = "data.frame", row.names = c(NA, 5L)) 

colnames(a) <- c("Estimated abundance of\n White Sharks\n $\\\\geq$ 40 inches in total length","Percentage of 3 year old\n White shark in the population\n $\\\\geq{40}$ inches in total length")
grid.table(a)

```

I have tried different variations but I can't get it right. Can someone point me on the right direction? I also tried using kableExtra with no luck. This is what I get, notice my column headers:

enter image description here

I found an example with kable() here: How to create table in rmarkdown using greek letters in column headers? but I tried it on my example and it does not work either


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>