R Markdown for Psychology Graduate Students
March 24, 2021
Chapter 1 Welcome
I designed this guide to be a resource for psychology graduate students looking to streamline their research pipelines.
With R Markdown, you can load, clean, manipulate, analyze, and present your data in one environment. This guide focuses on the presentation piece, with information on creating slides, posters, manuscripts, CVs, and reports in several formats, including HTML, PDF, and Microsoft Word.
This guide assumes a basic level of familiarity with R and RStudio. If you don’t know how to use either of these, there are several beginner tutorials you should check out first. I have also created primers for Beginner and Intermediate R in Chapter 9.
1.2 Getting started
What is R Markdown?
Markdown is a specific markup language with plain text-formatting syntax, of which R Markdown is a specific variety.
R Markdown and R are not the same thing! R Markdown combines R code (or code from other programming languages) and markdown in the RStudio integrated development environment (IDE). This allows you to embed code and text in the same document.
You can install the
rmarkdown package from CRAN or GitHub:
install.packages("rmarkdown") # or the development version: # devtools::install_github("rstudio/rmarkdown")
1.2.1 General tips
- Treat your data as read-only
- Comment code early and often
- Keep code chunks small
- Label chunks to help with diagnosing issues
- Nest all files under one directory (if possible)