Chapter 5 Report

Literate programming, an idea developed by Donald Knuth, mixes code that can be executed with regular text. The files you create can then be rendered, to run any embedded code. The final output will have results from your code and the regular text.

R has a collection of packages that extend these ideas of literate programming, allowing you to create reports that interweave R code, the results from that code, and text. This collection include the packages knitr and rmarkdown. I believe both are automatically installed to your computer when you install RStudio.

This section will walk you through some of the basics of creating two types of reports using RMarkdown: a basic RMarkdown report and a dashboard. The R project directory you downloaded in the “Prerequisites” section includes example files for both in its “reports” subdirectory.