kableExtra: Continued on Next Page for longtable
There is a kableExtra argument for that. I haven't checked but I suppose it wasn't available when the question was first posted.
From the documentation:
repeat_header_continued: T/F or a text string. Whether or not to put a continued mark on the second page of longtable. If you put in text, we will use this text as the "continued" mark.
The default is (continued...) so for your specific case it would be:
library(knitr)
library(kableExtra)
long_dt <- rbind(mtcars, mtcars)
kable(
long_dt,
format = "latex",
longtable = T,
booktabs = T,
caption = "Longtable"
) %>%
add_header_above(c(" ", "Group 1" = 5, "Group 2" = 6)) %>%
kable_styling(latex_options = c("repeat_header"),
repeat_header_continued = "\\textit{(Continued on Next Page...)}")
Output:
Produce a table spanning multiple pages using kable()
You can try to use the kableExtra package. If you specify hold_position
in kable_styling
, you should be able to ping the table to the place you want.
Also, in the current dev version, I introduced a new feature called repeat_header
for longtable
to repeat the header row on every page. You can check it out.
kable(output, "latex", booktabs = TRUE, longtable = TRUE, caption = "Test") %>%
kable_styling(latex_options = c("hold_position", "repeat_header"))
xTable Knitr Error - every line is printed underneath in PDF
If you want to knit in a pdf keep results='asis'
and don't print xtable
.
```{r echo=FALSE}
library(xtable)
swisstable <- sapply(swiss,function(x) {
c(Mean = mean(x), SD = sd(x), Median = median(x), IQR = IQR(x))
})
```
```{r results='asis', echo=FALSE}
xtable(swisstable, digits = 1, caption = "Tabelle 2: Überblick über den Datensatz swiss")
```
Related Topics
Mgcv Gam() Error: Model Has More Coefficients Than Data
How to Create a Pie Chart with Percentage Labels Using Ggplot2
How Does Settimelimit Work in R
R Shiny: How to Write Loop for Observeevent
How to Convert a Factor Column That Contains Decimal Numbers to Numeric
How to Show a Loading Screen When the Output Is Being Calculated in a Background Process
Condition Filter in Dplyr Based on Shiny Input
Get(X) Does Not Work in R Data.Table When X Is Also a Column in the Data Table
How to Write Data from R to Postgresql Tables with an Autoincrementing Primary Key
How to Convert List of List into a Tibble (Dataframe)
Inserting Stargazer or Xable Table into Knitr Document
R - Download Filtered Datatable
Error: X Must Be Atomic for 'Sort.List'
R Equivalent of Stata Local or Global MACros
Saving a File to Sharepoint with R