This repository contains the documentation for reproducibility of the study "Preoperative atelectasis in patients with obesity undergoing bariatric surgery: a cross-sectional study". The current status of the repository is reflective of the original research paper published in the peer-reviewed journal Anesthesia & Analgesia. The linked dataset for this study can be found in the Harvard Dataverse.
The manuscript was priorly published as a preprint, available through medRxiv.
This study was presented as a poster in the Annual Netherlands Epidemiology Congress WEON 2024.
In order to replicate these analyses, I suggest that the user follows these steps:
- Install R and RStudio on your computer if you haven't done so. (Note that these analyses were conducted under R version 4.3.3 and RStudio 2023.12.1).
- Clone this repository. If you do not know how to do this, you can follow these instructions. Alternatively, you can go to zenodo and download the ZIP file, unpack it, and place it in a folder in your computer.
- You should now have all these files in your computer with an identical folder structure (described in the following section).
- In the main directory, open the file named preoperative_atelectasis.Rproj in RStudio.
- You can navigate through the folders on the right-bottom panel of R Studio. Open the R folder. You should now see a series of files starting with Part_ and ending with .qmd.
- Open one of these files. You can run every chunk of code sequentially to reproduce the analyses. Make sure to respect the order and if something fails, I recommend that you start running al chunks of code from the beginning. If you don't know how to run a chunk of code, you can imitate what this person is doing. If you get a message saying "Access denied", change from Visual to Source mode which can be done with the Ctrl+Shift+F4 command.
I recommend that the .qmd files are opened and ran in sequential order, although some may only be interested in one of the parts of the analyses. If you are not able to follow the prior steps, you may also consider reviewing the PDF reports documenting the analyses. The sequence of these files is as follows:
- Part 1. Application of selection criteria and assessment of missing data. PDF
- Part 2. Descriptive analyses. PDF
- Part 3. Assessment of relationships between independent variables. PDF
- Part 4. Assessment of outcomes. PDF
- Part 5. Statistical modelling: Atelectasis. PDF
- Part 6. Mediation analysis of the effect of BMI on SpO2, mediated through atelectasis. PDF
- Part 7. Posthoc analyses. PDF
- Part 8. Mediation analysis of the effect of BMI on SpO2, mediated through atelectasis, distinguishing between high and low SpO2 values. PDF
Although I have made significant efforts to ensure reproducibility of this project, I encourage you to contact me or post a request in this repository in case you encounter any issues.
The project structure distinguishes three kinds of folders:
- read-only (RO): not edited by either code or researcher
- human-writeable (HW): edited by the researcher only.
- project-generated (PG): folders generated when running the code; these folders can be deleted or emptied and will be completely reconstituted as the project is run.
.
├── .gitignore
├── CITATION.cff
├── LICENSE
├── README.md
├── preoperative_atelectasis.Rproj
├── data <- All project data files
│ ├── processed <- The final, canonical data sets for modeling. (PG)
│ ├── raw <- The original, immutable data. (RO)
│ └── temp <- Intermediate data that has been transformed. (PG)
├── docs <- Documentation for users (HW)
│ ├── manuscript <- Manuscript source, docx. (HW)
│ ├── reports <- Project reports, pdf. (HW)
│ └── DAG <- Directed Acyclic Graph documentation, txt. (HG)
├── results
│ ├── output_figures <- Figures for the manuscript or reports (PG)
│ └── output_tables <- Output tables for the manuscript (PG)
└── R <- Source code for this project (HW)
│ ├── scripts <- Scripts sourced in main R markdown documents (PG)
│ └── sessions <- Text files with information of R sessions (PG)
└── renv <- Packaging dependencies (RO)
The full documentation with comments of statistical analyses can be found in the reports folder. Each PDF file documents sequential parts of the analyses, identified as Part 1 to Part 8 files as mentioned before. These reports describe the operating system of R and package versions dependencies to reproduce each part of the analyses. I have also included package dependencies in the renv folder in a lockfile.
This project is licensed under the terms of the MIT License.
This project structure repository is adapted from the Utrecht University simple R project template, which builds upon the Good Enough Project Cookiecutter template by Barbara Vreede (2019).