338 Pages
    by Chapman & Hall

    338 Pages
    by Chapman & Hall

    R Markdown: The Definitive Guide is the first official book authored by the core R Markdown developers that provides a comprehensive and accurate reference to the R Markdown ecosystem. With R Markdown, you can easily create reproducible data analysis reports, presentations, dashboards, interactive applications, books, dissertations, websites, and journal articles, while enjoying the simplicity of Markdown and the great power of R and other languages.

    In this book, you will learn

    • Basics: Syntax of Markdown and R code chunks, how to generate figures and tables, and how to use other computing languages
    • Built-in output formats of R Markdown: PDF/HTML/Word/RTF/Markdown documents and ioslides/Slidy/Beamer/PowerPoint presentations
    • Extensions and applications: Dashboards, Tufte handouts, xaringan/reveal.js presentations, websites, books, journal articles, and interactive tutorials
    • Advanced topics: Parameterized reports, HTML widgets, document templates, custom output formats, and Shiny documents.

    Yihui Xie is a software engineer at RStudio. He has authored and co-authored several R packages, including knitr, rmarkdown, bookdown, blogdown, shiny, xaringan, and animation. He has published three other books, Dynamic Documents with R and knitr, bookdown: Authoring Books and Technical Documents with R Markdown, and blogdown: Creating Websites with R Markdown.

    J.J. Allaire is the founder of RStudio and the creator of the RStudio IDE. He is an author of several packages in the R Markdown ecosystem including rmarkdown, flexdashboard, learnr, and radix.

    Garrett Grolemund is the co-author of R for Data Science and author of Hands-On Programming with R. He wrote the lubridate R package and works for RStudio as an advocate who trains engineers to do data science with R and the Tidyverse.

    Preface

    How to read this book

    Structure of the book

    Software information and conventions

    Acknowledgments


    About the Authors

    Yihui Xie

    J.J. Allaire

    Garrett Grolemund

     

    I Get Started


    1 Installation

     

    2 Basics

    2.1 Example applications

    2.2 Compile an R Markdown document

    2.3 Cheat sheets

    2.4 Output formats

    2.5 Markdown syntax

    2.6 R code chunks and inline R code

    2.7 Other language engines

    2.8 Interactive documents


    II Output Formats

    3 Documents

    3.1 HTML document

    3.2 Notebook

    3.3 PDF document

    3.4 Word document

    3.5 OpenDocument Text document

    3.6 Rich Text Format document

    3.7 Markdown document

    3.8 R package vignette

    4 Presentations

    4.1 ioslides presentation

    4.2 Slidy presentation

    4.3 Beamer presentation

    4.4 PowerPoint presentation

     

    III Extensions


    5 Dashboards

    5.1 Layout

    5.2 Components

    5.3 Shiny

     

    6 Tufte Handouts

    6.1 Headings

    6.2 Figures

    6.3 Sidenotes

    6.4 References

    6.5 Tables

    6.6 Block quotes

    6.7 Responsiveness

    6.8 Sans-serif fonts and epigraphs

    6.9 Customize CSS styles

     

    7 xaringan Presentations

    7.1 Get started

    7.2 Keyboard shortcuts

    7.3 Slide formatting

    7.4 Build and preview slides

    7.5 CSS and themes

    7.6 Some tips

     

    8 reveal.js Presentations

    8.1 Display modes

    8.2 Appearance and style

    8.3 Slide transitions

    8.4 Slide backgrounds

    8.5 2-D presentations

    8.6 Custom CSS

    8.7 reveal.js options

    8.8 reveal.js plugins

    8.9 Other features


    9 Community Formats

    9.1 Lightweight Pretty HTML Documents

    9.2 The rmdformats package

    9.3 Shower presentations

     

    10 Websites

    10.1 Get started

    10.2 The directory structure

    10.3 Deployment

    10.4 Other site generators

    10.5 rmarkdown’s site generator

     

    11 HTML Documentation for R Packages

    11.1 Get started

    11.2 Components


    12 Books

    12.1 Get started

    12.2 Project structure

    12.3 Markdown extensions

    12.4 Output Formats

    12.5 Editing

    12.6 Publishing


    13 Journals

    13.1 Get started

    13.2 Articles templates

    13.3 Using a template

    13.4 LaTeX content

    13.5 Linking with bookdown

    13.6 Contributing templates


    14 Interactive Tutorials

    14.1 Get started

    14.2 Tutorial types

    14.3 Exercises

    14.4 Quiz questions

    14.5 Videos

    14.6 Shiny components

    14.7 Navigation and progress tracking


    IV Other Topics

     

    15 Parameterized reports

    15.1 Declaring parameters

    15.2 Using parameters

    15.3 Knitting with parameters

    15.4 Publishing


    16 HTML Widgets

    16.1 Overview

    16.2 A widget example (sigma.js)

    16.3 Creating your own widgets

    16.4 Widget sizing

    16.5 Advanced topics


    17 Document Templates

    17.1 Template structure

    17.2 Supporting files

    17.3 Custom Pandoc templates

    17.4 Sharing your templates

     

    18 Creating New Formats

    18.1 Deriving from built-in formats

    18.2 Fully custom formats

    18.3 Using a new format

     

    19 Shiny Documents

    19.1 Getting started

    19.2 Deployment

    19.3 Embedded Shiny apps

    19.4 Shiny widgets

    19.5 Multiple pages

    19.6 Delayed rendering

    19.7 Output arguments for render functions

     

    Biography

    Yihui Xie is a software engineer at RStudio. He has authored and co-authored several R packages, including knitr, rmarkdown, bookdown, blogdown, shiny, xaringan, and animation. He has published three other books, Dynamic Documents with R and knitr, bookdown: Authoring Books and Technical Documents with R Markdown, and blogdown: Creating Websites with R Markdown.

    J.J. Allaire is the founder of RStudio and the creator of the RStudio IDE. He is an author of several packages in the R Markdown ecosystem including rmarkdown, flexdashboard, learnr, and radix.

    Garrett Grolemund is the co-author of R for Data Science and author of Hands-On Programming with R. He wrote the lubridate R package and works for RStudio as an advocate who trains engineers to do data science with R and the Tidyverse.

    "The manuscript offers a detailed documentation of the R Markdown document format and its related packages for R (e.g. knitr, rmarkdown, flexdashboard, shiny). These packages form an important ecosystem for reproducible research using R and are widely used across academia and the private sector. All the authors have been key contributors to developing the core R Markdown packages and are knowledgable about the inner workings of these functions and all the available options to customize published documents…The target audience for this manuscript would be experienced R users who frequently use R Markdown to generate publications for a variety of mediums (articles, books, information dashboards, interactive web applications, etc.)…While this book is strongly related to the author’s previous book (Dynamic Documents with R and knitr), a wider range of readers should find this new manuscript useful for its focus on the broad range of output formats generated by R Markdown and how to customize those outputs." ~Benjamin Soltoff, Department of Computational Social Science, University of Chicago

    "A main strength of the software described herein is that it facilitates reproducible documents incorporating analyses and figures. The first topics covered in chapters 6-13 include handout and presentation formats that could be used effectively for teaching or presenting statistical results. The other topics focus on larger scale documents such as complex websites, books, and academic journal articles. From academic teaching and research to industry and other settings, the material covered by this book allows statisticians and data scientists to disseminate results in a highly effective manner." ~David Whitney, Department of Biostatistics, University of Washington

    "This book will be a valuable reference for students, academics, and professionals using R – that is to say, any one in a wide (and growing) variety of fields focused on practical data analysis including statistics, machine learning, the social sciences, etc. There is increasing awareness that nearly any occasion calling for analysis code also calls for some amount of corresponding documentation, explanation, and/or interpretation. Rapid improvement in tools for R markdown has made integrating code and text less and less of a chore, and therefore more and more common – even among users new to R. R markdown is a popular choice now for a range of formats including blog posts, user manuals, books, dissertations, and undergraduate homework assignments. I personally use R markdown for nearly all of my website content, presentations, research papers, and to generate reports for the clients of my statistical consulting business. Because of its many applications, however, the ecosystem of R markdown tools has become unwieldy, and many tutorials reference outdated techniques or unnecessary workarounds. A definitive guide has been long needed." ~Rose Hartman, UnderstandingData

    "This book is so far the most comprehensive reference for the R Markdown format and its associated extensions and tools. On a high level, Part I and II (Chapter 1-4) of this book cover the basic use of the R Markdown document and the knitr and rmarkdown packages, which are helpful for new users to quickly get started. Part III (Chapter 5-13) introduces a lot of new developments and powerful tools for R Markdown, including creating presentations, authoring books, building websites, writing journal articles, etc. In my personal point of view this is the most attractive part of this book, as it opens a new world for users who have only used R Markdown to create ordinary documents." ~Yixuan Qui, Department of Statistics, Purdue University

    "This book represents a valuable contribution to the target field due to its exploration of a wide range of features in the markdown language. If other books on this topic exist, this one has the advantage that the authors have already made significant contributions to the markdown language in the R platform and certainly have a comprehensive understanding of the topic…I recommend this book for publication because the topic is sophisticated and complex, and the interested audience will certainly be satisfied with the clarity of presentation and the depth that the authors reach in their exploratory examples" ~Jon Katz, data analyst