Reputation: 897
The following simple code in Rmarkdown
will generate a table with a caption on top.
library(dplyr)
df <- iris %>% head()
knitr::kable(df, caption = "Table caption is on the top")
Is there any way to move the table caption generated by kable
function to the bottom?
Upvotes: 1
Views: 1011
Reputation: 19857
Try the package {xtable}
which does put table caption at bottom and then pass the xtable object to kableExtra::xtable2kable
to turn the xtable object into a kable object and then you have the caption at the bottom of the table.
```{r message=FALSE}
library(dplyr)
library(xtable)
library(kableExtra)
df <- iris %>% head()
xtable(df, caption = "Table caption is on the top") %>%
xtable2kable()
```
The rendered output looks like
To know more about this caption position issue, follow this issue-thread on Github.
Upvotes: 1