I am trying to produce mutltiple tables using the flextable and kable packages. When I want to output some table iteratively, I found knit_print
of flextable is not working in loop. Below is a minimal example:
---
output: word_document
---
```{r}
library(flextable)
library(knitr)
```
```{r}
data(cars)
speed<-unique(cars$speed)
for (v in 1:length(speed)) {
carspd<-cars[which(cars$speed==speed[v]),]
tb<-regulartable(carspd)
knit_print(tb)
}
knit_print(tb)
```
Just the last knit_print
can print the result to the word_document with the .Rmd
file.
Now I find the difference of them in .md
which is output by the pandoc process file with ultraedit,
the right table:
```{=openxml}
<w:tbl xmlns:w=".......
the wrong table:
鈥媊``{=openxml}
<w:tbl xmlns:w="
In hexadecimal there are extra content:"E2 80 8B", someone call they Zero-Width Space? But I am not figure out how to avoid it.