I am using the kable()
function of knitr package to produce a nice book quality table in a pdf document. The output is as below where the table is placed on the left.
I want to place the table at the center as below.
I would appreciate if anyone can give some advice. I know I can do it using xtable
. Is there any way I can do it directly using kable?
The complete reproducible knitr code (.Rnw file) is as below;
\documentclass{article}
\usepackage{booktabs}
\begin{document}
<<results='asis'>>=
library(knitr)
kable(head(women), format='latex', booktabs=TRUE)
@
\end{document}
pandoc
you (RStudio) are using, you might want to update thectable
orlongtable
environment instead oftabular
– daroczig