Dynamic Documents with R and knitr, 2nd Edition

Book description

Quickly and Easily Write Dynamic Documents

Suitable for both beginners and advanced users, Dynamic Documents with R and knitr, Second Edition makes writing statistical reports easier by integrating computing directly with reporting. Reports range from homework, projects, exams, books, blogs, and web pages to virtually any documents related to statistical graphics, computing, and data analysis. The book covers basic applications for beginners while guiding power users in understanding the extensibility of the knitr package.

New to the Second Edition

  • A new chapter that introduces R Markdown v2
  • Changes that reflect improvements in the knitr package
  • New sections on generating tables, defining custom printing methods for objects in code chunks, the C/Fortran engines, the Stan engine, running engines in a persistent session, and starting a local server to serve dynamic documents

Boost Your Productivity in Statistical Report Writing and Make Your Scientific Computing with R Reproducible

Like its highly praised predecessor, this edition shows you how to improve your efficiency in writing reports. The book takes you from program output to publication-quality reports, helping you fine-tune every aspect of your report.

Table of contents

  1. Cover
  2. Title Page
  3. Copyright Page
  4. Dedication
  5. Table of Contents
  6. Preface
  7. Author
  8. List of Figures
  9. List of Tables
  10. 1 Introduction
  11. 2 Reproducible Research
    1. 2.1 Literature
    2. 2.2 Good and Bad Practices
    3. 2.3 Barriers
  12. 3 A First Look
    1. 3.1 Setup
    2. 3.2 Minimal Examples
      1. 3.2.1 An Example in LATEX
      2. 3.2.2 An Example in Markdown
    3. 3.3 Quick Reporting
    4. 3.4 Extracting R Code
  13. 4 Editors
    1. 4.1 RStudio
    2. 4.2 LYX
    3. 4.3 Emacs/ESS
    4. 4.4 Other Editors
  14. 5 Document Formats
    1. 5.1 Input Syntax
      1. 5.1.1 Chunk Options
      2. 5.1.2 Chunk Label
      3. 5.1.3 Global Options
      4. 5.1.4 Chunk Syntax
    2. 5.2 Document Formats
      1. 5.2.1 Markdown
      2. 5.2.2 LATEX
      3. 5.2.3 HTML
      4. 5.2.4 reStructuredText
      5. 5.2.5 AsciiDoc
      6. 5.2.6 Textile
      7. 5.2.7 Customization
    3. 5.3 Output Renderers
    4. 5.4 R Scripts
  15. 6 Text Output
    1. 6.1 Inline Output
    2. 6.2 Chunk Output
      1. 6.2.1 Chunk Evaluation
      2. 6.2.2 Code Formatting
      3. 6.2.3 Code Decoration
      4. 6.2.4 Show/Hide Output
      5. 6.2.5 Collapse Output
      6. 6.2.6 Trim Blank Lines
    3. 6.3 Tables
    4. 6.4 Automatic Printing
    5. 6.5 Themes
  16. 7 Graphics
    1. 7.1 Graphical Devices
      1. 7.1.1 Custom Device
      2. 7.1.2 Choose a Device
      3. 7.1.3 Device Size
      4. 7.1.4 More Device Options
      5. 7.1.5 Encoding
      6. 7.1.6 The Dingbats Font
    2. 7.2 Plot Recording
    3. 7.3 Plot Rearrangement
      1. 7.3.1 Animation
      2. 7.3.2 Alignment
    4. 7.4 Plot Size in Output
    5. 7.5 Extra Output Options
    6. 7.6 The tikz() Device
    7. 7.7 Figure Environment
    8. 7.8 Figure Path
  17. 8 Cache
    1. 8.1 Implementation
    2. 8.2 Write Cache
    3. 8.3 When to Update Cache
    4. 8.4 Side Effects
    5. 8.5 Chunk Dependencies
      1. 8.5.1 Manual Dependency
      2. 8.5.2 Automatic Dependency
    6. 8.6 Load Cache Manually
    7. 8.7 Other Options
  18. 9 Cross Reference
    1. 9.1 Chunk Reference
      1. 9.1.1 Embed Code Chunks
      2. 9.1.2 Reuse Whole Chunks
    2. 9.2 Code Externalization
      1. 9.2.1 Labeled Chunks
      2. 9.2.2 Line-Based Chunks
    3. 9.3 Child Documents
      1. 9.3.1 Input Child Documents
      2. 9.3.2 Child Documents as Templates
      3. 9.3.3 Standalone Mode
  19. 10 Hooks
    1. 10.1 Chunk Hooks
      1. 10.1.1 Create Chunk Hooks
      2. 10.1.2 Trigger Chunk Hooks
      3. 10.1.3 Hook Arguments
      4. 10.1.4 Hooks and Chunk Options
      5. 10.1.5 Write Output
    2. 10.2 Examples
      1. 10.2.1 Crop Plots
      2. 10.2.2 rgl Plots
      3. 10.2.3 Manually Save Plots
      4. 10.2.4 Optimize PNG Plots
      5. 10.2.5 Close an rgl Device
      6. 10.2.6 WebGL
  20. 11 Language Engines
    1. 11.1 Design
      1. 11.1.1 The Engine Function
      2. 11.1.2 Engine Options
    2. 11.2 Languages and Tools
      1. 11.2.1 C++
      2. 11.2.2 C/Fortran
      3. 11.2.3 Interpreted Languages
      4. 11.2.4 Stan
      5. 11.2.5 TikZ
      6. 11.2.6 Graphviz
      7. 11.2.7 Highlight
      8. 11.2.8 Other Engines
    3. 11.3 Persistent Sessions
  21. 12 Tricks and Solutions
    1. 12.1 Chunk Options
      1. 12.1.1 Option Aliases
      2. 12.1.2 Option Templates
      3. 12.1.3 Program Chunk Options
      4. 12.1.4 Code in Appendix
      5. 12.1.5 Local R Options
      6. 12.1.6 Dynamic Code
    2. 12.2 Package Options
    3. 12.3 Typesetting
      1. 12.3.1 Output Width
      2. 12.3.2 Message Colors
      3. 12.3.3 Box Padding
      4. 12.3.4 Beamer
      5. 12.3.5 Suppress Long Output
      6. 12.3.6 Escape Special Characters
      7. 12.3.7 The Example Environment
      8. 12.3.8 The Docco Style
    4. 12.4 Utilities
      1. 12.4.1 R Package Citation
      2. 12.4.2 Image URI
      3. 12.4.3 Upload Images
      4. 12.4.4 Compile Documents
      5. 12.4.5 Construct Code Chunks
      6. 12.4.6 Extract Source Code
      7. 12.4.7 Reproducible Simulation
      8. 12.4.8 R Documentation
      9. 12.4.9 Rst2pdf
      10. 12.4.10 Package Demos
      11. 12.4.11 Pretty Printing
      12. 12.4.12 A Macro Preprocessor
      13. 12.4.13 Exit Knitting Early
      14. 12.4.14 Literal knitr Source Code
      15. 12.4.15 Spell Checking
    5. 12.5 Debugging
    6. 12.6 Multilingual Support
  22. 13 Publishing Reports
    1. 13.1 RStudio
    2. 13.2 Pandoc
    3. 13.3 HTML5 Slides
    4. 13.4 Jekyll
    5. 13.5 WordPress
  23. 14 R Markdown
    1. 14.1 Overview
    2. 14.2 Pandoc’s Markdown Extensions
      1. 14.2.1 Basic Syntax
      2. 14.2.2 YAML Metadata
    3. 14.3 Output Formats
      1. 14.3.1 HTML Document
      2. 14.3.2 LATEX/PDF Document
      3. 14.3.3 Word Document
      4. 14.3.4 Markdown Documents
      5. 14.3.5 ioslides Presentation
      6. 14.3.6 Slidy Presentation
      7. 14.3.7 Beamer Presentation
      8. 14.3.8 Other Formats
    4. 14.4 Interactive Documents with Shiny
    5. 14.5 Extending R Markdown v2
      1. 14.5.1 Templates
      2. 14.5.2 New Formats
      3. 14.5.3 HTML Widgets
    6. 14.6 Changes in R Markdown from v1 to v2
  24. 15 Applications
    1. 15.1 Homework
    2. 15.2 Serve Dynamic Documents
    3. 15.3 Website and Blogging
      1. 15.3.1 Vistat and Rcpp Gallery
      2. 15.3.2 UCLA R Tutorial
      3. 15.3.3 The cda and RHadoop Wiki
      4. 15.3.4 The ggbio Package
      5. 15.3.5 Geospatial Data in R and Beyond
    4. 15.4 Package Vignettes
      1. 15.4.1 Vignette Metadata and Engines
      2. 15.4.2 Vignette Examples
      3. 15.4.3 PDF Vignette
      4. 15.4.4 HTML Vignette
    5. 15.5 Books
      1. 15.5.1 This Book
      2. 15.5.2 The Analysis of Data
      3. 15.5.3 The Statistical Sleuth in R
      4. 15.5.4 Text Analysis with R for Students of Literature
    6. 15.6 Literate Programming for R Packages
  25. 16 Other Tools
    1. 16.1 Sweave
      1. 16.1.1 Syntax
      2. 16.1.2 Options
      3. 16.1.3 Problems
    2. 16.2 Other R Packages
    3. 16.3 Python Packages
      1. 16.3.1 Dexy
      2. 16.3.2 PythonTEX
      3. 16.3.3 IPython
    4. 16.4 More Tools
      1. 16.4.1 Org-mode
      2. 16.4.2 SASweave
      3. 16.4.3 Office
  26. Appendix
    1. A Internals
      1. A.1 Documentation
      2. A.2 Closures
      3. A.3 Implementation
        1. A.3.1 Parser
        2. A.3.2 Chunk Hooks
        3. A.3.3 Option Aliases
        4. A.3.4 Cache
        5. A.3.5 Compatibility with Sweave
        6. A.3.6 Concordance
      4. A.4 Syntax
  27. Bibliography
  28. Index

Product information

  • Title: Dynamic Documents with R and knitr, 2nd Edition
  • Author(s): Yihui Xie
  • Release date: July 2017
  • Publisher(s): Chapman and Hall/CRC
  • ISBN: 9781315360706