Knit one markdown file to two output files

Actually, the knit button can indeed -

  • Render multiple outputs.
  • Use a custom output directory.

Example with output directory called output:

title: "multiple outputs"
output:
  word_document: default
  html_document: default
knit: (function(inputFile, encoding) {
  rmarkdown::render(inputFile, encoding = encoding,
  output_dir = "output", output_format = "all") })

Yes it's possible to render multiple outputs, but not with the "knit" Button in RStudio. Write your desired output in the YAML header and then use output_format = "all" as argument in

rmarkdown::render(<your-rmd-file.rmd>, output_format ="all")

So the YAML header looks like:

title: "multiple outputs"
output:
     word_document: default
     html_document: default

Or any option you want to set for the different output formats.

I don't know if it is possible to set different output directories, but I don't think so.