| title: "xtable & kableExtra" |
| ```{r setup, include=FALSE} |
| knitr::opts_chunk$set(message = FALSE) |
| Recent versions of kableExtra (since 1.0) offers a function `xtable2kable`, which, as suggested by its name, turns a `xtable` object to a `kable` object so you can use functions in kableExtra after that. I tested some basic examples and it seem to work. |
| xtable(mtcars[1:5, 1:5]) %>% |
| column_spec(1, width = "5cm") |
| xtable(mtcars[1:5, 1:5], caption = "Some long caption") %>% |
| xtable2kable(caption.width = "10em") %>% |
| column_spec(1, color = "red") |