# RMarkdown for Scientists

*2020-09-09*

# About this

This is a book on rmarkdown, aimed for scientists. It was initially developed as a 3 hour workshop, but is now developed into a resource that will grow and change over time as a **living book**.

This book aims to teach the following:

- Getting started with your own R Markdown document
- Improve workflow:
- With RStudio projects
- Using keyboard shortcuts

- Export your R Markdown document to PDF, HTML, and Microsoft Word
- Better manage figures and tables
- Reference figures and tables in text so that they dynamically update
- Create captions for figures and tables
- Change the size and type of figures
- Save the figures to disk when creating an R Markdown document

- Work with equations
- Inline and display
- Caption equations
- Reference equations

- Manage bibliographies
- Cite articles in text
- Generate bibliographies
- Change bibliography styles

- Debug and handle common errors with R Markdown
- Next steps in working with rmarkdown - how to extend yourself to other rmarkdown formats

## 0.1 Why write this as a book?

There are many great books on R Markdown and it’s various features, such as “Rmarkdown: The definitive guide”, “bookdown: Authoring Books and Technical Documents with R Markdown”, and “Dynamic Documents with R and knitr, Second edition”, and Yihui Xie’s thesis, “Dynamic Graphics and Reporting for Statistics”.

So why write a book?

Good question. The answer is that writing this as a book provides a way for me to structure the content in the form of a workshop, in a way suitable for learning in a few hours.

## 0.2 How to use this book

This book was written to provide course materials for a 3 hour course on R Markdown.

We worked through the following sections in the book in 3 hours:

- Why use R Markdown
- Installation
- what is RStudio?
- suggested workflow and hygiene
- how to use R Markdown
- using R Markdown with pdf, html, and Word
- what are some useful keyboard shortcuts
- Adding captions to tables and figures
- Changing figures
- Adding mathematics
- Citing figures and tables
- Changing citations and styles

With the remaining sections being used as extra material, or have since been written after the course:

- Fixing some common problems in R Markdown
- What are some alternative outputs of R Markdown?
- Where to go next?
- Suggested references

Course materials can be downloaded by using the following command from the `usethis`

package:

## 0.3 Where has this course been taught?

So far I have taught this rmarkdown for science course at the following locations:

- 2018
- Melbourne, November for SSA Victoria

- 2019
- Melbourne, April, for Monash University
- Canberra, July, for SSA Victoria
- Melbourne, November, for AIMOS2019
- Melbourne, December, for Plant Pathology Conference

- 2020
- Seattle, February, for University of Washington

## 0.4 Licence

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