So far you’ve seen R Markdown used to produce HTML documents. This chapter gives a brief overview of some of the many other types of output you can produce with R Markdown. There are two ways to set the output of a document:
Permanently, by modifying the the YAML header:
Transiently, by calling
rmarkdown::render() by hand:
This is useful if you want to programmatically produce multiple types of output.
RStudio’s knit button renders a file to the first format listed in its
output field. You can render to additional formats by clicking the
drop-down menu beside the knit button.
Each output format is associated with an R function. You can either
pkg::foo. If you omit
pkg, the default is assumed to
be rmarkdown. It’s important to know the name of the function that makes
the output because that’s where you get help. For example, to figure out
what parameters you can set with
html_document, look at
To override the default parameter values, you need to use an expanded
output field. For example, if you wanted to render an
with a floating table of contents, you’d use:
You can even render to multiple ...