kableExtra is an R package that helps to build common complex tables (in both HTML and pdf) and manipulate table styles. Using the pipe %>% symbol one can add "layers" to a kable output to get a well-formatted table.
Questions tagged [kableextra]
680 questions
7
votes
1 answer
kableExtra only works if there's another table in the presentation?
When I use kableExtra for a PDF output, the table renders beautifully, BUT gives an error if there isn't another, non-kable extra table in the program. Has anyone else seen this behavior? the file appears to knit fine, but then throws an error in…

M. M.
- 109
- 2
- 7
7
votes
1 answer
Changing column width in R's kable does not change width of headers
I am using kable to make tables of my data in RMarkdown. You can supposedly adjust column width using the column_spec command, however this seems to adjust only the columns of the data, itself, but does not also adjust the column width of my header…

Alison K.
- 71
- 1
- 2
7
votes
1 answer
kableExtra: Continued on Next Page for longtable
I am using kableExtra for longtable with the following code.
library(knitr)
library(kableExtra)
long_dt <- rbind(mtcars, mtcars)
kable(
long_dt,
format = "latex",
longtable = T,
booktabs = T,
caption =…

MYaseen208
- 22,666
- 37
- 165
- 309
6
votes
1 answer
Combine kableExtra tables with ggplot2 elements
I have a ggplot2 element and a KableExtra table. Is it possible to combine them into one object with patchwork, cowplot or any other package and print it in an rmarkdown document? If there's not a solution, is there any other table package, with…

daniellga
- 1,142
- 6
- 16
6
votes
0 answers
R kable linebreak cutting off striped color
Below is a code example. My issue is that the background color for the rows with the linebreak are being cut short. Any idea how to fix this? I tried limiting the column width and that did the trick, but with other unwanted side effects such as…

David
- 432
- 3
- 10
6
votes
2 answers
Format captions in kableExtra()
Is it possible to format captions in kableExtra? I would like to center and bold a caption for a table when knitting to HTML in RMarkdown. I have tried to wrap the table in a CSS div where the text was centered, but this did not produce the intended…

Bjørn Kallerud
- 979
- 8
- 23
6
votes
2 answers
rmarkdown & kable/kableextra: Printing % symbol in Table when using escape = F
I want to create a table in a pdf-document using rmarkdwon and kable.
In the header there has to be a linebreak, so to do so i need to set escape = F.
The table itself contains percent-values as strings including the % symbol (for example: "13%").…

TinglTanglBob
- 627
- 1
- 4
- 14
6
votes
5 answers
kableExtra column_spec width not working
I am creating tables that will be rendered using Rmarkdown to HTML. I am using kable and have been experimenting with kableExtra to add features to my tables. I am not able to get the width option in column_spec to work when applying it to all…

kr32
- 63
- 1
- 4
6
votes
2 answers
R - kable() used in .Rmd does not show output in notebook
I just started using kableExtra library to make my tables look better in the PDF output.
But when I use kable() function in R Notebook file, it does not show the output. Instead I see a large white space where the output should be.
Here is a…

jmich738
- 1,565
- 3
- 24
- 41
6
votes
3 answers
Is it possible to remove horizontal lines in Kable kableextra with html option?
I am trying to create a table using kable/kableextra without showing the horizontal lines in the table except for the first row which is the row names.
```
{r echo=FALSE}
library(knitr)
library(kableExtra)
options(knitr.kable.NA = '')
dt <-…

Stephen Lien
- 221
- 1
- 2
- 3
6
votes
2 answers
How to change the strip color on kableExtra
The color of the strips are very lite on Kable on Pdf output. So is there a way to change the color on kable_styling(latex_options = "striped")?

S.Perera
- 874
- 3
- 9
- 24
5
votes
2 answers
How to force linebreaks in kableExtra functions with escape = FALSE?
In kableExtra >= 0.8.0, the canonical way to insert a linebreak into text piped into a table from a kableExtra function such as add_header_above or pack_rows is to add an \n directly.
However, this appears not to work with the escape = FALSE…

Westcroft_to_Apse
- 1,503
- 4
- 20
- 29
5
votes
2 answers
R kable/kableExtra, conditional formatting by percentage (with missing values)
I am using kable and kableExtra and want to display a table with columns of percentages (in format "95%"). I would also like to do conditional formatting of the cell backgrounds based on the percent value (with multiple colors and cut points). In…

Megan C
- 53
- 1
- 3
5
votes
1 answer
Save as_kable_extra (format = "latex") on file
I use as_kable_extra(table, format="latex").
This code gives me a chuck of latex codes, then I copy and paste then save it as a tex table.
Can I save the latex code on R so that I can avoid copy and paste?

HSC
- 129
- 6
5
votes
0 answers
R- How to add html formatting to a table that works with blastula?
Blastula appears to not respect the