From Data to Thesis: Research Data Analysis with R
Playground, Chapter 19: Putting It All Together

The complete thesis project, from the raw survey export to a results chapter.

How to run it
1. Double-click chapter19.Rproj. RStudio opens with this folder as the working directory.
2. Open R/01-clean-data.R and click Source. It reads data-raw/wellbeing_raw.xlsx
   and writes clean tables to data/.
3. Open R/02-analysis.R and click Source. It fits the models and writes
   output/results.rds and output/figure-1.png.
4. Open results.qmd and click Render. It produces the results chapter as a web
   page and a Word document, with every number taken from the analysis.
Then work through exercises.txt, the project tasks. exercises.R holds the R
parts of the playground page, in four parts (practise, go further, check your
understanding, do it yourself), with answers in solutions.R; it runs the
cleaning script first if data/ does not exist yet.

The project needs these packages (install once):
install.packages(c("dplyr", "tidyr", "stringr", "readr", "readxl", "here",
                   "ggplot2", "patchwork", "lme4", "broom", "knitr", "rmarkdown"))
You also need Quarto, which is installed with RStudio.

Folders
- data-raw/   the survey export; never edit it by hand
- R/          the scripts, numbered in the order they run
- data/       clean data, created by R/01-clean-data.R
- output/     results and figures, created by R/02-analysis.R
Everything in data/ and output/ can be deleted and recreated by running the scripts.

Please note: Elaf and her data are fictional. The data was generated by a
computer program to look realistic, and its patterns were built in by the
author. It describes no real people and is not evidence about real students;
do not cite or use it as research findings.

Browser exercises for this chapter are at:
https://polla-fattah.github.io/R4NTR/playground/chapter19.html
