Search code examples
rlatexknitrr-markdownkaggle

Style a kable table knitted to pdf


I'm using kable to output a table from a data.frame in a R markdown document that is parsed to pdf.

This is the output: enter image description here

I would like to style the table. Specifically I'd like to:

  • Increase cell height. The padding argument passed to kable() function didn't have effect.
  • Make the headings bold. (No idea about this).

I call kaggle() in a function that is then called into the chunk in the .Rmd file.

Thanks for your help


Solution

  • I don't know whether you tried already, but the kableExtra package offers a lot more features than kable. You could simply pipe your kable call into row specifications with

    %>% row_spec (0, bold = T)

    I couldn't find an option for cell height there. In case you'd generally want to change it you could either pass it as an option into the YAML header or change the default.tex file.

    Regards