Rmarkdown :: render in parallel

I have an R package, one of its functions is to create a report. In inst / markdown, I have a rep.rmd template. In the function of the ProduceReport () package, I have this code:

  render.file <-"rep.Rmd"
  render.file <- system.file(TEMPLATES.PATH, render.file, package=getPackageName())
  render.dir <- dirname(render.file)
  pdf.file <- "example.pdf"
  rmarkdown::render(render.file , quiet = FALSE, output_format = "pdf_document")

This works, but at run time markdown creates temp file directories

rep_cache, rep_files

I would like to test this report generation function in parallel (when .rmd files work with different inputs and create different reports). My first question is: is it possible to run the same .rmd file with different inputs?

I think that temporary directories should have unique names in order to avoid writing to the same files. I found the arguments

intermediates_dir =, knit_root_dir =

rmarkdown:: render(). , pandoc ( rep_cache, rep_files ).

, .

+6

Source: https://habr.com/ru/post/1016656/


All Articles