John-Henry
John-Henry

Reputation: 1817

Centering column names with `pander` while left justifying content

I am using the pander::pander function to make some tables in a knitted latex document. I want the rows to be left justified and the column names to be centered.

library(pander)
library(dplyr)

tibble(`column name` = c("long text string", "* hi")) %>% 
    pander(
      keep.line.breaks = TRUE, 
      style = 'grid', 
      missing = '', 
      split.table = Inf,
      justify = 'left'
      )

left justified pander output

Does the pander function have an argument to center column names? I am having trouble finding it in the documentation or anywhere else online.

Upvotes: 1

Views: 215

Answers (1)

Ronak Shah
Ronak Shah

Reputation: 389325

You can try using pandoc.table :

tibble(`column name` = "long text string") %>% 
  pandoc.table()

#------------------
#   column name    
#------------------
# long text string 
#------------------

Upvotes: 1

Related Questions