output_format argument of
render to render your .Rmd file into any of R Markdown’s supported formats. For example, the code below renders 1-example.Rmd to a Microsoft Word document. You can try it out here on RStudio Cloud.
library(rmarkdown) render("1-example.Rmd", output_format = "word_document")
If you do not select a format, R Markdown renders the file to its default format, which you can set in the
output field of a .Rmd file’s header. The header of 1-example.Rmd shows that it renders to an HTML file by default.
The RStudio IDE knit button renders a file to the first format listed in its
output field. You can render to additional formats by clicking the dropdown menu beside the knit button:
The following output formats are available to use with R Markdown.
Each output format is implemented as a function in R. You can customize the output by passing arguments to the function as sub-values of the
output field. For example, 8-outputs.Rmd would render with a floating table of contents.
To learn which arguments a format takes, read the format’s help page in R, e.g.