I am trying to generate about 50 reports with the same template in rMarkdown. I do not want to change the name of the input file every time and I would like to choose different names for output files.
Is there any way how to automate this process?
Thank you.
Another option is to render your reports using the render() function of the rmarkdown package in a seperate R script.
report.Rmd looks like this:
---
output: pdf_document
---
# A table with data received from R script
```{r,results='asis'}
library("knitr")
kable(mydataset)
```
The R script looks like that:
library("rmarkdown")
for (i in 1:50){
mydataset <- head(mtcars)
render( input="report.Rmd", output_file=paste0("reportNo_", i, ".pdf") )
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With