I know of the emphasize.rownames
argument but have not been able to find its equivalent for column names. Attempted to look into panderOptions --> header.style
to no avail.
Please find some test code below that emphasizes the first column but not its header. Ideally, I'd be able to specify which column names I'd like to emphasize but will be happy enough if I can at least emphasize the entire header. Thanks.
library(pander)
test = data.frame(Model = 1:3, Score = c(87,32,98), IQ = c(110,180,98))
# Print out the dataframe as a table using pander
pandoc.table(test, emphasize.strong.cols = 1)
EDIT
To clarify - I am looking to create a table in a PDF document using rmarkdown
, knitr
and pander
. Here is example code - I'd like the header to be emphasized, but it is not by default on my machine:
---
title: "myexample"
output: pdf_document
---
```{r myexamp_setup, message = FALSE, echo=FALSE}
require(pander)
require(knitr)
test = data.frame(Model = 1:3, Score = c(87,32,98), IQ = c(110,180,98))
```
```{r myexamp_tab, echo = FALSE, results = 'asis'}
pandoc.table(test, emphasize.strong.cols = 1)
```
Please consider opening a ticket on GitHub for this feature request -- but until this is not supported, I hope the following workaround might help:
Also, I grab the chance to suggest using the generic
pander
method instead ofpandoc.table
. You save 6 characters each time you type it :) And it has some very cool extra features.