When I created tables within an rnotebook and used kable on tables, I could knit it into a word document.
However I needed subheadings in between some rows, and resorted to pack_rows from kableExtra library.
This time the word document is not rendered, even though I followed the advice in the error announcement and added " always_allow_html: true":
Error: Functions that produce HTML output found in document targeting docx output.
Please change the output type of this document to HTML. Alternatively, you can allow
HTML output in non-HTML formats by adding this option to the YAML front-matter of
your rmarkdown file:
always_allow_html: true
Does anybody have any idea how to make this knit into a word document?
An example:
library(tidyverse)
library(kableExtra)
table <- mtcars %>% group_by(cyl) %>% summarise(mean(mpg),sd(mpg),IQR(mpg))
table
table <- kable(table) %>% pack_rows("first",1,1) %>% pack_rows("second",2,2) %>% pack_rows("third",3,3)
table