This workshop will provide an introduction to R Markdown documents in R which provide a powerful way to combine text and code to create publications and other documents with integrated charts, figures and other code-generated analyses.
This workshop uses an adapted version of the data paper: Nitsch, F. J., Sellitto, M., & Kalenscher, T. (2021). The effects of acute and chronic stress on choice consistency. Psychoneuroendocrinology, 131, 105289. https://doi.org/10.1016/j.psyneuen.2021.105289. The data paper along with its underlying data publicly available at: https://osf.io/6mvq7 were adapted and used for educational purposes with authors’ permission.
Workshop goals
- Learn about the uses of R Markdown documents
- Learn about the basic components of R Markdown documents
- Learn how to edit text in R Markdown documents
- Learn how to add code to R Markdown documents
Pre-requisites
STOP: before starting this workshop, please attend the following Digital Scholarship Lab workshop(s) before completing this one:
OR make sure you’re comfortable with the following concepts (study suggestions in parentheses)
- basic understanding of the RStudio IDE environment
- basic understanding of R programming recommended
Workshop Content
Time Estimate | Section | Keypoints |
---|---|---|
Pre-Workshop | Setup | Install required software and download files required for the lesson |
00:00 | 1. Scientific reproducibility: What is it for? |
What is reproducible research?
How can RStudio help research to be more reproducible? What are the benefits of using RStudio for writing academic essays and papers? |
00:20 | 2. Navigating RStudio and R Markdown Documents |
How do you find your way around RStudio?
How do you start an R Markdown document in Rstudio? How is an R Markdown document configured and how do I work with it? |
00:50 | 3. Introduction to Working with R Markdown Files |
What is the breakdown of an R Markdown file?
What are templates in R Markdown? How can you render the input file to the specified output format? How can you find existing templates for R Markdown files? |
01:15 | 4. Writing and Styling Rmd Documents |
What is the Visual Editor in Rstudio?
Which features does the Visual Editor have? How can I can apply styling and formatting to rmd documents in Rstudio more easily? How to add inline code? |
01:35 | 5. Adding Code-Generated Plots and Figures |
What is Knitr?
What are code chunks and how they are structured? How can you run code from your rmd document? What are global knitr options? What are global chunk options? |
02:45 | 6. Global Code Chunk Settings & Inline Code |
What are global knitr options?
What are global chunk options? What is inline code and when to use it? |
03:55 | 7. Bibliography & Citations |
How can you insert citations to your manuscripts using RStudio’s visual editor?
How can you change citation styles? What are the options to display cited and uncited bibliography? |
04:30 | Finish | Please fill out the workshop survey |
The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.
Survey
Thank you for attending this workshop or reading through the workshop material! If you could take 3-5 min to respond to our anonymous survey, we can continue to improve this workshop. We appreciate any and all feedback!
Next Up…
Check out these workshops after you’ve completed this one: