Chapter 16. R Markdown and Publishing
While R by itself is an incredibly powerful tool for data analysis and visualization, almost all of us, after we do analysis, will need to communicate the results to others. We may do that with published papers, blog posts, PowerPoint presentations, or books. R Markdown is the tool that helps us go from R analysis and visualization all the way to publishable documents.
R Markdown is a package (as well as an ecosystem of tools) that allows us to add R code to a plain-text file with some Markdown formatting. The document can then be rendered into many different output formats, including PDF, HTML, Microsoft Word, and Microsoft PowerPoint. At rendering, also called knitting, the R code is run and the resulting output and figures are placed in the final document.
In this chapter we’ll give you recipes to get you started creating R Markdown documents. After you go through these recipes, one of the best ways to learn more about R Markdown is by looking at the source files and final output of other people’s R Markdown work. The book you are reading was itself written in R Markdown. You can see the source to this book on GitHub.
In addition, Yihui Xie, J. J. Allaire, and Garrett Grolemund have written R Markdown: The Definitive Guide (Chapman & Hall/CRC) and also made the source R Markdown available on GitHub.
Many other books written with R Markdown have been made freely available online.
We mentioned that R Markdown is an ecosystem as well as a ...
Get R Cookbook, 2nd Edition 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.