A Quart o’ rUM

Using the rUM Package for Reproducible Medical Research

Raymond Balise, PhD

Gabriel Odom, PhD ThD

Kyle Grealis, (Almost) MS

Francisco Cardozo, (ABD) PhD

What is rum?

What is rUM?

rUM is an R package designed to help lighten the memory load for people who want to use R Markdown or Quarto to support reproducible (biomedical) research.

rUM (version 0.3.2)

  • Code snippet/header templates for R Markdown
    • html2 with rUM - ready for tidyverse/tidymodels
    • html2 Details with rUM - with Table of Contents
    • bookdown_site with rUM
    • pdf2 showing LaTeX with rUM - floating content, big tables
  • A research paper/project done in R Markdown

rUM (version 1.0.x)

  • Added a research paper/project template for Quarto!

Code Snippet/Header Templates

html2 with rUM

  • YAML header
    • What is the syntax for the date?
  • Setup code block with common options
    • How do you enable/disable warnings/errors/notes?
    • How do I turn off the ## in output?
    • How do I get numbers rounded to three decimal places?
  • Code block for conflicted and tidyverse packages
    • How do I set the conflicted options?
    • How to I start tidyverse quietly?
    • How do I turn off the dplyr summary note?
  • Code block tidymodels
    • How do I always prefer tidymodels functions?

Code Snippet/Header Templates

html2 with rUM

  • YAML header
  • Setup code block with common options
  • Code block for conflicted and tidyverse packages
  • Code block tidymodels

How do I access the templates?

  1. File Menu > New File
  2. Choose R Markdown…
  3. Chose From Template
  4. Scroll down until you see rUM
  5. Click OK

Version 1.0.x - Quarto or R Markdown paper shell (and more)

rUM also provides a research project template.

  • A Paper Shell (defaults to Quarto)
    • YAML header has a bibliography reference-style file
    • Paper sections
    • The methods section with examples showing package references
    • Code to add packages to your bibliography
    • Bibliography file
  • An “aggressive” .gitignore file.

How?

  1. File Menu > New Project…
  2. New Directory >
  3. Scroll down & choose rUM Research Project Template
  4. Type a name, pick a location and file type
  5. Click Create Project

Useful Details - YAML

  • The YAML header includes the line: csl: the-new-england-journal-of-medicine.csl which is the reference style template for The New England Journal of Medicine.
    • If you download other style templates from zotero into the directory and use the file name in the header, the bibliography and references will be properly formatted.

Useful Details - Methods

  • The methods section automatically includes the version number of R and examples of how to reference packages with their version.

Analyses were conducted with `r stringr::word(R.Version()$version.string, 1, 3)` with the tidyverse (`r packageVersion(“tidyverse”)`), rUM (`r packageVersion(“rUM”)`), table1 (`r packageVersion(“table1”)`) packages used to preprocess and summarize data.[@R-base; @R-tidyverse; @tidyverse2019; @R-rUM; @R-table1]

Analyses were conducted with R version 4.2.0 with the tidyverse (1.3.2), rUM (1.0), table1 (1.4.2) packages used to preprocess and summarize data.1–5

Useful Details - References\(_1\)

  • If any R packages are used by the analysis file, the first time you knit/render, their details are automatically added to the bibliography file:
# Results

```{r}
library(gtsummary)
```

Useful Details - References\(_2\)

References can then be added to the Rmd or qmd file by emulating what is in the methods section and/or using the point-and-click tools in RStudio’s Visual editor.

.gitignore

  • Because not all organizations have HIPAA safe code repositories for people who use git for version controlling code, rUM projects add an “aggressive” gitignore file that tries to block the backup of the data formats that I use the most (Python, R, SAS, SPSS, STATA).
    • If you are not an expert with git, always ask for help when setting up your projects. Confirm that the .gitignore file tags all your data formats.
    • If you are an expert, tell me what else you would like added to the .gitignore file.

Q & A

Sticker Time!

  • If you would like a rUM sticker, send me an email (and a self-addressed stamped envelope). I bought enough for the first 100 people. So go!!!!