I am knitting to pdf using kable()
to draw some tables. I create a few tables functionally, thus some of them end up being split between pages. Is there any way to prevent this behavior?
I know I could just move to a new page after each table but I would much rather have multiple kables on the same page.
If you're only exporting to PDF, then try this:
knitr::kable(
my_data,
format = "latex",
longtable = FALSE
)
A longtable table allows page breaks between rows. Looking at the code for knitr:::kable_latex
, which kable
calls, the default should be longtable = FALSE
. But explicitly setting this argument makes sure you're not making longtables.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With