HHH
HHH

Reputation: 45

Add caption below table using kable

I am building a table using kable and I would like to add a caption below the tale. However, the caption is automatically set above the table. Is there a way to change this?

Thanks a lot!

tb <- kable(x, caption = 'yyy', digits=c(0, 3, 2, 2, 0, 3, 2), booktabs=T) %>% 
  kable_styling(latex_options="scale_down")

Upvotes: 1

Views: 1971

Answers (2)

leogama
leogama

Reputation: 1059

For HTML output, you may add this CSS snippet to your RMarkdown document:

```{css, echo=FALSE}
table { caption-side: bottom }
```

Upvotes: 1

Ronak Shah
Ronak Shah

Reputation: 389235

How about using footnote ?

library(knitr)
library(kableExtra)

kable(mtcars[1:5, 1:5], booktabs=T) %>% 
  kable_styling(latex_options="scale_down") %>%
  footnote(general = "yyy", general_title = "")

enter image description here

Upvotes: 1

Related Questions