1) Create template for different output formats (e.g. .pdf, .doc) like the .html template here: https://github.com/andschar/dbreport/blob/master/inst/rmd/rmarkdown_template.Rmd 2) Create appropriate method to switch between templates.
https://github.com/andschar/dbreport/blob/master/inst/rmd/rmarkdown_template.Rmd