I know I am being very picky here, but I am making a table using the following code using knitr in r markdown:
---
title: "Test table"
author: "Derek Corcoran"
date: "February 20, 2017"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Tables
This is a $\psi$
```{r, results='asis', echo = FALSE}
library(xtable)
Softwares <- structure(list(X = structure(c(9L, 5L, 7L, 4L, 1L, 8L, 6L, 2L,
3L), .Label = c("Alpha diversity models", "Build in model selection",
"Built in response plot", "Multiple Species Abundance", "Multiple Species Single Season occupancy",
"Priority area selection", "Single Species Abundance", "Single Species Dynamic occupancy",
"Single Species Single Season occupancy"), class = "factor"),
Diversityoccupancy = structure(c(1L, 1L, 1L, 1L, 1L, NA,
1L, 1L, 1L), .Label = "x", class = "factor"), Unmarked = structure(c(1L,
NA, 2L, NA, NA, 2L, NA, NA, NA), .Label = c("$\\checkmark$",
"x"), class = "factor"), stocc = structure(c(1L, NA, NA,
NA, NA, NA, NA, NA, NA), .Label = "x", class = "factor"),
Presence = structure(c(1L, NA, 1L, NA, NA, 1L, NA, NA, NA
), .Label = "x", class = "factor"), Pom = structure(c(1L,
NA, NA, NA, NA, NA, NA, NA, NA), .Label = "x", class = "factor"),
camptrapR = structure(c(1L, NA, NA, NA, NA, NA, NA, NA, NA
), .Label = "x", class = "factor")), .Names = c("X", "Diversityoccupancy",
"Unmarked", "stocc", "Presence", "Pom", "camptrapR"), class = "data.frame", row.names = c(NA,
-9L))
names <- colnames(Softwares[,-1])
colnames(Softwares) <- c("", names)
print(xtable(Softwares, align = rep("c", 8)), scalebox='0.75')
```
I had all the values where the function applies as an x, but I want to change it into a check mark. As you can see in the first part that is not a code were I put This is a $\psi$
, it translates to what you would expect in a latex document. However, when I change an x to $\checkmark$ as it is recomended in this link. It stays that way in the table, as shown in the image bellow:
How can I change that to a checkmark?
Change your call to xtable()
to:
print(xtable(Softwares, align = rep("c", 8)), scalebox='0.75',
type = "latex", sanitize.text.function = function (x) x)