By jjallaire
The R Markdown package ships with a raft of output formats including HTML, PDF, MS Word, R package vignettes, as well as Beamer and HTML5 presentations. This isn’t the entire universe of available formats though (far from it!). R Markdown formats are fully extensible and as a result there are several R packages that provide additional formats. In this post we wanted to highlight a few of these packages, including:
- tufte — Documents in the style of Edward Tufte
- rticles — Formats for creating LaTeX based journal articles
- rmdformats — Formats for creating HTML documents
We’ll also discuss how to create your own custom formats as well as re-usable document templates for existing formats.
Using Custom Formats
Custom R Markdown formats are just R functions which return a definition of the format’s behavior. For example, here’s the metadata for a document that uses the html_document
format:
--- title: "My Document" output: html_document ---
When rendering, R Markdown calls the rmarkdown::html_document
function to get the definition of the output format. A custom format works just the same way but is also qualified with the name of the package that contains it. For example, here’s the metadata for a document that uses the tufte_handout
format:
--- title: "My Document" output: tufte::tufte_handout ---
Custom formats also typically register a template that helps you get started with using them. If you are using RStudio you can easily create a new document based on a custom format via the New R Markdown dialog:
Tufte Handouts
The tufte package includes custom formats for creating documents in the style that Edward Tufte uses in his books and handouts. Tufte’s style is known for its extensive use of sidenotes, tight integration of graphics with text, and well-set typography. Formats for both LaTeX and HTML/CSS output are provided (these are in turn based on the work in tufte-latex and tufte-css). …read more
Source:: http://blog.rstudio.org