I would like to combine several kable
tables into one single image.
Something like:
library(knitr)
library(kableExtra)
dt <- mtcars[1:5, 1:4]
# first table
table1 <- kable(dt, format = "html", caption = "Demo Table") %>%
kable_styling(bootstrap_options = "striped",
full_width = F) %>%
add_header_above(c(" ", "Group 1" = 2, "Group 2[note]" = 2)) %>%
add_footnote(c("table footnote"))
# second table
table2 <- kable(dt, format = "html", caption = "Demo Table") %>%
kable_styling(bootstrap_options = "striped",
full_width = F) %>%
add_header_above(c(" ", "Group 1" = 2, "Group 2[note]" = 2)) %>%
add_footnote(c("table footnote"))
and put table1
on top of table2
in an image:
bind_rows(table1, table2) %>%
kable_as_image(., filename = 'P:/mytable/table')
However, this does not work. How can I do that? Thanks!