How to set knitr::kable() global options in markdown for reuse

前端 未结 1 1812
遇见更好的自我
遇见更好的自我 2020-12-31 18:06

Is there an easy to use way to setup custom default kable() options, so that there is no need in rewriting them for each kable() call.

For

相关标签:
1条回答
  • 2020-12-31 18:26

    Just write your own function to do that:

    kable <- function(data) {
      knitr::kable(data, booktabs = TRUE, digits = 2) %>% 
        kable_styling(latex_options =c("striped", "scale_down"))
    }
    

    It might be less confusing to give it a new name instead of masking kable; that's up to you.

    0 讨论(0)
提交回复
热议问题