This page collects a few example files and web resources for writing R markdown files. With R markdown, via the rmarkdown and knitr packages, you can make beautiful reports including text, code, and output. Output formats include HTML, Word, PDF (when Latex is installed), and presentations (in HTML).
- The manual to the R course (which can be accessed via this direct link) includes since recently an introduction to writing markdown files in R. See sections from page 11. Note that this introduction focuses on making Word documents with rmarkdown, but the basic principles are the same for HTML output.
- The documentation page for rmarkdown at Rstudio: this page describes all the options you can cram into the 'top matter' (the YAML header at the top of each rmarkdown document), which largely affect output styling, code formatting, fonts, etc. Note that options vary depending on output chosen : browse to the HTML page (further down the page), for example.
- The documentation page for the knitr package includes all the options you can fit into the code chunks.
- Example 'rmarkdown' file (for the R course.This file shows the basics of using rmarkdown to combine code and output, and generate a Word document. For this example file, and the next one, you need CSV files in your working directory which can be downloaded from here.
- A simple rmarkdown example, as a basis to add options for formatting HTML documents.
- Example 'rmarkdown' file shows various options to generate tables in Word documents.
- Simple example rmarkdown file with a set of tabbed figures.
- Simple example rmarkdown file with an animated set of figures (You need to install ffmpeg for this to work).
- Simple example 'parameterized' rmarkdown file, allowing an input to the file (in this case, a CSV file to be summarized).
A full manuscript in rmarkdown
- The four files needed to make a complete manuscript for submission to a journal (in the usual Word document with double-spaced lines, references, figures, tables, and inline code). (Zip file; unzip all into one folder, open 'manuscript.Rmd').