Skip to contents

A clerk keeps tabs — clerkR keeps yours publication-ready.

License: MIT R


📖 What is clerkR?

clerkR transforms standard R data frames into publication-ready tables for biomedical and neuroscience manuscripts. Rather than wrestling with formatting each time, clerkR reduces the most common table types to a handful of opinionated constructor functions that share consistent theming, domain grouping, footnote handling, and a unified rendering pipeline for both Word/PDF (gt) and interactive HTML (reactable) output.

✨ Features

  • 📋 Five table archetypes covering ~90% of what appears in a biomed paper
  • 🗂️ Domain/section grouping — organise rows under labelled headers
  • 📝 Automatic footnotes for log-transformed variables and FDR correction
  • 🎨 Dual render targetsrender_gt() for Word/PDF, render_reactable() for HTML
  • 🔢 Significance annotation — p-values, FDR-corrected p, stars (toggleable)
  • 🧩 Composable — all constructors return a clerk_tbl S3 object

🗂️ Project Structure

clerkR/
├── R/
│   ├── clerkR-package.R       # Package-level documentation
│   ├── tbl_descriptive.R      # Archetype 1: Table 1 / descriptive
│   ├── render.R               # render_gt() and render_reactable()
│   └── clerk_example.R        # Synthetic example dataset docs
├── data/
│   └── clerk_example.rda      # Synthetic example dataset
├── data-raw/
│   └── clerk_example.R        # Script to generate example data
├── tests/testthat/
│   └── test-tbl_descriptive.R
├── man/                       # Auto-generated by roxygen2
├── DESCRIPTION
├── NAMESPACE
└── README.md

🚀 Getting Started

Prerequisites

install.packages(c("dplyr", "tidyr", "rlang", "gt", "reactable"))

Installation

# Development version from GitHub
remotes::install_github("circadia-bio/clerkR")

Basic usage

library(clerkR)

# Descriptive / Table 1
tbl_descriptive(
  clerk_example,
  group   = sex,
  domains = list(
    "Metabolic"     = c("hdl", "glucose", "bmi"),
    "Anthropometric"= c("waist", "systolic_bp"),
    "Cognitive"     = c("tmt_time", "verbal_fluency"),
    "Mental health" = c("bdi", "panas_neg", "life_satisfaction")
  ),
  log_vars = c("tmt_time"),
  fdr      = TRUE
) |>
  render_gt(title = "Table 1. Sample characteristics by sex")

📦 Dependencies

Package Version Purpose
dplyr ≥ 1.1.0 Data manipulation
tidyr any Reshaping
rlang any Tidy evaluation
gt ≥ 0.10.0 Word/PDF table rendering
reactable ≥ 0.4.0 Interactive HTML rendering

👥 Authors

Role Name
Author, maintainer Lucas G. S. França
  • 🕐 zeitR — actigraphy analysis and circadian metrics
  • 📓 slumbR — sleep diary processing
  • 📋 tallieR — questionnaire and sociodemographic data
  • 🔗 syncR — integrates zeitR, slumbR, and tallieR into a unified database
  • 🔬 circadia-bio — the Circadia Lab GitHub organisation

📄 Licence

Released under the MIT License.

Copyright © Lucas G. S. França, 2026