Chapter 21. R Markdown
Introduction
R Markdown provides a unified authoring framework for data science, combining your code, its results, and your prose commentary. R Markdown documents are fully reproducible and support dozens of output formats, like PDFs, Word files, slideshows, and more.
R Markdown files are designed to be used in three ways:
-
For communicating to decision makers, who want to focus on the conclusions, not the code behind the analysis.
-
For collaborating with other data scientists (including future you!), who are interested in both your conclusions, and how you reached them (i.e., the code).
-
As an environment in which to do data science, as a modern day lab notebook where you can capture not only what you did, but also what you were thinking.
R Markdown integrates a number of R packages and external tools. This
means that help is, by and large, not available through ?
. Instead,
as you work through this chapter, and use R Markdown in the future, keep
these resources close to hand:
-
R Markdown Cheat Sheet: available in the RStudio IDE under Help â Cheatsheets â R Markdown Cheat Sheet
-
R Markdown Reference Guide: available in the RStudio IDE under Help â Cheatsheets â R Markdown Reference Guide
Both cheatsheets are also available at http://rstudio.com/cheatsheets.
Prerequisites
You need the rmarkdown package, but you donât need to explicitly install it or load it, as RStudio automatically does both when needed.
R Markdown Basics
This is ...
Get R for Data Science now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.