3  Methods


This section describes the tools and methods used to create and utilize this template.

This template itself is the “method”. It prescribes a specific way to organize and execute a reproducible research project.

3.1 Core Technologies

  1. Quarto: The primary authoring tool. It uses Markdown syntax for text and integrates executable code chunks (primarily R, but also Python, Julia, etc.). Key features used:
    • Book Format: Organizes the article into chapters/sections.
    • Code Chunks: Embed R code directly ({r}) for analysis and visualization.
    • Citations: Managed via references.bib (BibTeX) and formatted using apa7ed.csl. You can use Zotero in RStudio for this.
    • Embedding Outputs: Results from scripts in Scripts/ can be embedded into the narrative using {{< embed >}} (see Results section).
  2. R & RStudio: The computational engine and integrated development environment (IDE). R/RStudio is used for statistical analysis, data manipulation, and creating visualizations within Quarto documents.
  3. Git & GitHub:
    • Git: Provides version control locally. Every significant change to your project files is tracked.
    • GitHub: Hosts the repository online, enabling collaboration, sharing, backup, and to publish the dynamic document (Github Pages). It also integrates with GitHub Actions.
  4. Environment Management:
    • renv: (Proper Reproducibility) Tracks and restores specific R package versions used in the project. The renv.lock file is the key component.
    • Docker: (Full Reproducibility) Packages the entire software environment (R, RStudio, Quarto, packages, LaTeX) into a container. This guarantees that the environment is identical for anyone running the project. The docker/ folder contains the necessary configuration (Dockerfile, docker-compose.yml, start/stop scripts).
  5. Sharing & Publication:
    • OSF: A platform for registering, storing, and sharing research materials openly.
    • GitHub Pages: A free service to host the rendered HTML version of your Quarto book/article directly from your GitHub repository. The .github/workflows/deploy.yml file automates this process.

3.2 Workflow Integration

If you need to learn a little more about Reproducible Research with R/RStudio, there are excellent free e-books:

The typical workflow using this template for Full Reproducibility involves:

  1. Setting up the environment using Docker (docker/start.sh or start.bat).
  2. Working within the RStudio container to edit .qmd files, run code chunks, and manage R packages (tracked by renv).
  3. Rendering the document using quarto render in the RStudio Terminal.
  4. Stopping the Docker environment when done (docker/stop.sh or stop.bat).
  5. Using Git locally to commit and push changes to your GitHub repository.
  6. Optionally, pushing to the main branch triggers the GitHub Actions workflow to automatically publish the updated HTML site to GitHub Pages.