Search code examples
rr-markdownbookdown

rmarkdown: render to .pdf using existing .md files created for .html


Is that possible at all? At the moment I have to render my .Rmd files twice, once for an html and once for a pdf report. Each of them take about 50 mins. So if I can use the html .md files created after rendering, that would save me 50 mins.


Solution

  • If your .md document is already created, you can simply use:

    library("rmarkdown")
    render("mydoc.md", output_format = "pdf_document")
    

    If you always need to generate both html and pdf, then render both at the same time using J_F's solution.