• R Markdown for Scientists
  • About this
    • 0.1 Why write this as a book?
    • 0.2 How to use this book
  • 1 Why RMarkdown
    • 1.1 Overview
    • 1.2 Questions
    • 1.3 Objectives
    • 1.4 Your Turn
    • 1.5 Reproducibility is a problem
    • 1.6 Literate programming is a partial solution
    • 1.7 Markdown as a new player to legibility
      • 1.7.1 A brief example of markdown
    • 1.8 Your Turn
    • 1.9 Rmarkdown helps complete the solution to the reproducibility problem
    • 1.10 Summary
    • 1.11 Learning more
  • 2 Installation
    • 2.1 Overview
    • 2.2 Questions
    • 2.3 Software Setup
      • 2.3.1 R
      • 2.3.2 RStudio
    • 2.4 RMarkdown
    • 2.5 A note on PDF
      • 2.5.1 Problem solving with LaTeX
    • 2.6 Test Script
  • 3 RStudio, What and Why
    • 3.1 Overview
    • 3.2 Questions
    • 3.3 Objectives
    • 3.4 What is RStudio, and why should I use it?
    • 3.5 Exercise: RStudio default options
    • 3.6 Learning more
  • 4 Workflow
    • 4.1 Overview
    • 4.2 Questions
    • 4.3 Objectives
    • 4.4 Your Turn
    • 4.5 When you start a new project: Open a new RStudio project
      • 4.5.1 So what does this do?
    • 4.6 What is a file path?
    • 4.7 Your Turn
    • 4.8 Is there an answer to the madness?
    • 4.9 Your Turn: Use your own rstudio project
    • 4.10 Your turn
    • 4.11 The “here” package
    • 4.12 Remember
      • 4.12.1 Aside: Creating an RStudio project
    • 4.13 Summary
  • 5 Using Rmarkdown
    • 5.1 Overview
    • 5.2 Questions
    • 5.3 Objectives
    • 5.4 The anatomy of an rmarkdown document
      • 5.4.1 Metadata
      • 5.4.2 Text
      • 5.4.3 Code
      • 5.4.4 Chunk names
    • 5.5 Code chunk options
      • 5.5.1 Inline code
    • 5.6 Creating an rmarkdown document
    • 5.7 Working with an rmarkdown document
      • 5.7.1 Your Turn
    • 5.8 Nick’s rmarkdown hygiene reccommendations
    • 5.9 Your Turn
  • 6 HTML, PDF, and Word (and more!)
    • 6.1 Overview
    • 6.2 Questions
    • 6.3 Objectives
    • 6.4 How do I convert to HTML, PDF, or Word?
      • 6.4.1 A note on workflow with rmarkdown: HTML first, PDF/word later
    • 6.5 Your Turn
  • 7 Keyboard Shortcuts
    • 7.1 Overview
    • 7.2 Questions
    • 7.3 Objectives
    • 7.4 Gifs of the action
      • 7.4.1 Knit document
      • 7.4.2 Insert Chunk
      • 7.4.3 Run Current Chunk
      • 7.4.4 Jump to
      • 7.4.5 Create multiple cursors
      • 7.4.6 Delete the current line
      • 7.4.7 Un/Comment out a line
      • 7.4.8 Reformat Section
      • 7.4.9 Show Keyboard Shortcut Reference
    • 7.5 Table of Common Shortcuts
    • 7.6 Further Reading
    • 7.7 Your Turn
  • 8 Figures, Tables, Captions.
    • 8.1 Overview
    • 8.2 Questions
    • 8.3 Objectives
    • 8.4 Tables
      • 8.4.1 Demo
      • 8.4.2 Your Turn
    • 8.5 Figures
      • 8.5.1 Captions for figures
      • 8.5.2 Your Turn
      • 8.5.3 Inserting images
      • 8.5.4 Your Turn
    • 8.6 Summary
  • 9 Customising your figures
    • 9.1 Overview
    • 9.2 Questions
    • 9.3 Objectives
    • 9.4 Which chunk options should you care about for this?
      • 9.4.1 Your Turn
    • 9.5 Setting global options
      • 9.5.1 Your Turn
    • 9.6 Keeping your figures
    • 9.7 Your Turn
    • 9.8 Further Reading
  • 10 Math
    • 10.1 Overview
    • 10.2 Questions
    • 10.3 Objectives
    • 10.4 Some history
    • 10.5 Anatomy of Equations
    • 10.6 Example math commands
    • 10.7 Exercise
    • 10.8 Further Reading:
  • 11 Citing Figures, Tables & Sections
    • 11.1 Overview
    • 11.2 Questions
    • 11.3 Objectives
    • 11.4 How to refer to tables and figures in text?
    • 11.5 Your Turn
    • 11.6 Referencing a figure
      • 11.6.1 Demo
      • 11.6.2 Your Turn
    • 11.7 Referencing a table
      • 11.7.1 Your Turn
    • 11.8 Referencing a section
      • 11.8.1 Your Turn
    • 11.9 One small note
  • 12 Citating Articles & Bibliography Styles
    • 12.1 Overview
    • 12.2 Questions
    • 12.3 Objectives
    • 12.4 How to cite things
      • 12.4.1 What is a .bib file?
      • 12.4.2 And how do I generate these .bib files?
      • 12.4.3 ## Your Turn
    • 12.5 How to change the bibliography style
      • 12.5.1 ## Your Turn
    • 12.6 How to move the bibliography location
      • 12.6.1 ## Your Turn
  • 13 Captioning and referencing equations
    • 13.1 Overview
    • 13.2 Questions
      • 13.2.1 Numbering equations
    • 13.3 Numbering equations
    • 13.4 Referencing equations
  • 14 Common Problems with rmarkdown (and some solutions)
    • 14.1 Avoiding problems
    • 14.2 The errors
    • 14.3 “Duplication”: Duplicated chunk names
    • 14.4 “Not what I ordered”: Objects not created in the right order
    • 14.5 “Forgotten Trails I”: Missing “,”, or “(”, “}”, or “’”
    • 14.6 “Forgotten Trails II”: Chunk option with trailing ", or not input
    • 14.7 “Forgotten Trail III”:
    • 14.8 “The Path Not Taken” File path incorrect
    • 14.9 “Spolling I” Incorrectly spelled chunk options
    • 14.10 “Spolling II” Incorrectly spelled chunk option inputs
    • 14.11 “The Legend of Link I”: Your images in ![]() don’t work.
    • 14.12 LaTeX errors
    • 14.13 I want to include inline R code verbatim to show an example
    • 14.14 My Figure or Table isn’t being cited
    • 14.15 Your Turn
  • 15 Different Outputs and Extensions
    • 15.1 Alternative output formats
    • 15.2 Tufte
      • 15.2.1 For Journals
      • 15.2.2 APA
      • 15.2.3 Misc
  • 16 Next Steps
    • 16.1 Learn how to use git and github
  • 17 References
  • 18 Acknowledgements
  • 19 Templates
    • 19.1 Controlling the outputs
      • 19.1.1 Options for HTML
      • 19.1.2 Options for PDF
      • 19.1.3 Options for Word
    • 19.2 How do I set options specific to each output
  • 20 FAQ
    • 20.1 How can I include a screenshot of an interactive graphic in PDF or Word?
  • 21 HTML document extensions
    • 21.0.1 Adding Tab sets
    • 21.0.2 Floating table of contents
    • 21.1 Your turn
  • Published with bookdown

RMarkdown for Scientists

17 References

R Markdown: The Definitive Guide

Bookdown

The RStudio cheatsheet

The official documentation of knitr

R4ds section on rmarkdown

Extending word templates: http://rmarkdown.rstudio.com/articles_docx.html

  • Templates: https://github.com/Pakillo/rmdTemplates

Notebooks: http://rmarkdown.rstudio.com/r_notebooks.html

  • rmarkdown chapter in R for data science
  • knitr in a nutshell
  • Maëlle Salmon’s Rmarkdown course
  • Jennifer Thompson’s Rmarkdown course

  • happy git with r