• R Markdown for Scientists
  • 1 Foreword
  • About this
    • 1.1 Why write this as a book?
    • 1.2 How to use this book
    • 1.3 Licence
  • 2 License
  • 3 Why R Markdown
    • 3.1 Overview
    • 3.2 Questions
    • 3.3 Objectives
    • 3.4 Your Turn
    • 3.5 Reproducibility is a problem
    • 3.6 Literate programming is a partial solution
    • 3.7 Markdown as a new player to legibility
      • 3.7.1 A brief example of markdown
    • 3.8 Your Turn
    • 3.9 R Markdown helps complete the solution to the reproducibility problem
    • 3.10 Summary
    • 3.11 Learning more
  • 4 Installation
    • 4.1 Overview
    • 4.2 Questions
    • 4.3 Software Setup
      • 4.3.1 R
      • 4.3.2 RStudio
    • 4.4 R Markdown
    • 4.5 A note on PDF
      • 4.5.1 Problem solving with LaTeX
    • 4.6 Test Script
  • 5 RStudio, What and Why
    • 5.1 Overview
    • 5.2 Questions
    • 5.3 Objectives
    • 5.4 What is RStudio, and why should I use it?
    • 5.5 Exercise: RStudio default options
    • 5.6 Learning more
  • 6 Workflow
    • 6.1 Overview
    • 6.2 Questions
    • 6.3 Objectives
    • 6.4 Your Turn
    • 6.5 When you start a new project: Open a new RStudio project
      • 6.5.1 So what does this do?
    • 6.6 What is a file path?
    • 6.7 Your Turn
    • 6.8 Is there an answer to the madness?
    • 6.9 Your Turn: Use your own RStudio project
    • 6.10 Your turn
    • 6.11 The “here” package
    • 6.12 Remember
      • 6.12.1 Aside: Creating an RStudio project
    • 6.13 Summary
  • 7 Using Rmarkdown
    • 7.1 Overview
    • 7.2 Questions
    • 7.3 Objectives
    • 7.4 The anatomy of an R Markdown document
      • 7.4.1 Metadata
      • 7.4.2 Text
      • 7.4.3 Code
      • 7.4.4 Chunk names
    • 7.5 Code chunk options
      • 7.5.1 Inline code
    • 7.6 Creating an RMarkdown document
    • 7.7 Working with an R Markdown document
      • 7.7.1 Your Turn
    • 7.8 Nick’s R Markdown hygiene recommendations
    • 7.9 Your Turn
  • 8 HTML, PDF, and Word (and more!)
    • 8.1 Overview
    • 8.2 Questions
    • 8.3 Objectives
    • 8.4 How do I convert to HTML, PDF, or Word?
      • 8.4.1 A note on workflow with R Markdown: HTML first, PDF/Word later
    • 8.5 Your Turn
  • 9 Keyboard Shortcuts
    • 9.1 Overview
    • 9.2 Questions
    • 9.3 Objectives
    • 9.4 Gifs of the action
      • 9.4.1 Knit document
      • 9.4.2 Insert Chunk
      • 9.4.3 Run Current Chunk
      • 9.4.4 Jump to
      • 9.4.5 Create multiple cursors
      • 9.4.6 Delete the current line
      • 9.4.7 Un/Comment out a line
      • 9.4.8 Reformat Section
      • 9.4.9 Show Keyboard Shortcut Reference
    • 9.5 Table of Common Shortcuts
    • 9.6 Further Reading
    • 9.7 Your Turn
  • 10 Figures, Tables, Captions.
    • 10.1 Overview
    • 10.2 Questions
    • 10.3 Objectives
    • 10.4 Tables
      • 10.4.1 Demo
      • 10.4.2 Your Turn
    • 10.5 Figures
      • 10.5.1 Captions for figures
      • 10.5.2 Your Turn
      • 10.5.3 Inserting images
      • 10.5.4 Your Turn
    • 10.6 Summary
  • 11 Customising your figures
    • 11.1 Overview
    • 11.2 Questions
    • 11.3 Objectives
    • 11.4 Which chunk options should you care about for this?
      • 11.4.1 Your Turn
    • 11.5 Setting global options
      • 11.5.1 Your Turn
    • 11.6 Keeping your figures
    • 11.7 Your Turn
    • 11.8 Further Reading
  • 12 Math
    • 12.1 Overview
    • 12.2 Questions
    • 12.3 Objectives
    • 12.4 Some history
    • 12.5 Anatomy of Equations
    • 12.6 Example math commands
    • 12.7 Exercise
    • 12.8 Further Reading:
  • 13 Citing Figures, Tables & Sections
    • 13.1 Overview
    • 13.2 Questions
    • 13.3 Objectives
    • 13.4 How to refer to tables and figures in text?
    • 13.5 Your Turn
    • 13.6 Referencing a figure
      • 13.6.1 Demo
      • 13.6.2 Your Turn
    • 13.7 Referencing a table
      • 13.7.1 Your Turn
    • 13.8 Referencing a section
      • 13.8.1 Your Turn
    • 13.9 One small note
  • 14 Citing Articles & Bibliography Styles
    • 14.1 Overview
    • 14.2 Questions
    • 14.3 Objectives
    • 14.4 How to cite things
      • 14.4.1 What is a .bib file?
      • 14.4.2 And how do I generate these .bib files?
      • 14.4.3 Your Turn
    • 14.5 How to change the bibliography style
      • 14.5.1 Your Turn
    • 14.6 How to move the bibliography location
      • 14.6.1 Your Turn
  • 15 Captioning and referencing equations
    • 15.1 Overview
    • 15.2 Questions
      • 15.2.1 Numbering equations
    • 15.3 Numbering equations
    • 15.4 Referencing equations
  • 16 Common Problems with R Markdown (and some solutions)
    • 16.1 Avoiding problems
    • 16.2 The errors
    • 16.3 “Duplication”: Duplicated chunk names
    • 16.4 “Not what I ordered”: Objects not created in the right order
    • 16.5 “Forgotten Trails I”: Missing “,”, or “(”, “}”, or “’”
    • 16.6 “Forgotten Trails II”: Chunk option with trailing ", or not input
    • 16.7 “Forgotten Trail III”:
    • 16.8 “The Path Not Taken” File path incorrect
    • 16.9 “Spolling I” Incorrectly spelled chunk options
    • 16.10 “Spolling II” Incorrectly spelled chunk option inputs
    • 16.11 “The Legend of Link I”: Your images in ![]() don’t work.
    • 16.12 LaTeX errors
    • 16.13 I want to include inline R code verbatim to show an example
    • 16.14 My Figure or Table isn’t being cited
    • 16.15 Your Turn
  • 17 Different Outputs and Extensions
    • 17.1 Alternative output formats
      • 17.1.1 Slideshows
      • 17.1.2 For Journals
      • 17.1.3 APA
      • 17.1.4 Misc
  • 18 Next Steps
    • 18.1 Learn how to use Git and GitHub
  • 19 References
  • 20 Acknowledgements
  • 21 Templates
    • 21.1 Controlling the outputs
      • 21.1.1 Options for HTML
      • 21.1.2 Options for PDF
      • 21.1.3 Options for Word
    • 21.2 How do I set options specific to each output
  • 22 FAQ
    • 22.1 How can I include a screenshot of an interactive graphic in PDF or Word?
  • 23 HTML document extensions
    • 23.0.1 Adding Tab sets
    • 23.0.2 Floating table of contents
    • 23.1 Your turn
  • Published with bookdown

R Markdown for Scientists

2 License

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.