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 example, my usual table styling uses following code:
library(kableExtra)
kable(mtcars, booktabs=TRUE, digits= 2) %>% kable_styling(latex_options =c("striped", "scale_down"))
I would like to set all kable()
kable_styling
options so that a call to kable(mtcars)
with no arguments defaults to my usual table styling.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With