When used in a loop, runs do not outputs
because knit_print
method is not called.
Use the function to force printing. Also you should tell the chunk
to use results 'as-is' (by adding results='asis'
to your chunk header).
See also
Other functions that force printing:
knit_print_block()
Examples
library(rmarkdown)
rmd_file_src <- system.file(
package = "officedown", "examples", "word_loop.Rmd")
rmd_file_des <- tempfile(fileext = ".Rmd")
if(pandoc_available()){
file.copy(rmd_file_src, to = rmd_file_des)
docx_file_1 <- tempfile(fileext = ".docx")
render(rmd_file_des, output_file = docx_file_1, quiet = TRUE)
if(file.exists(docx_file_1)){
message("file ", docx_file_1, " has been written.")
}
}
#> file /tmp/Rtmp5M0JrA/file1f3d28c830a4.docx has been written.