The Mad Hatter’s Guide to Data Viz and Stats in R
    • Data Viz and Stats
      • Tools
        • Introduction to R and RStudio
      • Data Kits
        • Healthcare Data Kits
      • Descriptions
        • Data
        • Inspect Data
        • Graphs
        • Summaries
        • Counts
        • Quantities
        • Groups
        • Distributions
        • Groups and Distributions
        • Change
        • Proportions
        • Hierarchy
        • Evolution and Flow
        • Ratings and Rankings
        • Surveys
        • Time
        • Space
          • Introduction to Maps
          • What is Vector Data?
          • The Grammar of Maps
          • Interactive Maps with leaflet
        • Networks
        • Miscellaneous Graphing Tools, and References
      • Inference
        • Basics
        • 🎲 Samples
        • Randomization
        • One Mean
        • Two Independent Means
        • Two Paired Means
        • Multiple Means (ANOVA)
        • Correlation
        • One Proportion
        • Two Proportions
      • Modelling
        • Modelling with Linear Regression
        • Modelling with Logistic Regression
        • 🕔 Modelling and Predicting Time Series
      • Workflow
        • Facing the Abyss
        • I Publish, therefore I Am
        • Data Carpentry
      • Arts
        • Colours
        • Fonts
        • Annotations
        • More Annotations
        • Highlighting
        • Scales
      • AI Tools
        • Using gander and ellmer
        • Using Github Copilot and other AI tools to generate R code
        • Using LLMs to Explain Stat models
      • Case Studies
        • Demo:Product Packaging and Elderly People
        • Ikea Furniture
        • Movie Profits
        • Gender at the Work Place
        • Heptathlon
        • School Scores
        • Children’s Games
        • Valentine’s Day Spending
        • Women Live Longer?
        • Hearing Loss in Children
        • California Transit Payments
        • Seaweed Nutrients
        • Coffee Flavours
        • Legionnaire’s Disease in the USA
        • Antarctic Sea ice
        • William Farr’s Observations on Cholera in London
      • Projects
        • No Free Hunch

    On this page

    • 1 Codebook — Group 7 — ERCP trial and the Americas
      • 1.0.1 Panel A
      • 1.0.2 Panel B
      • 1.0.3 Panel C
      • 1.1 Pair card (Day 1 brick)
      • 1.2 Forbidden list
      • 1.3 Sources

    1 Codebook — Group 7 — ERCP trial and the Americas

    Spine: Does a simple pill change post-procedure pancreatitis, who is in that trial, and where in the Americas is life long?

    1.0.1 Panel A

    age and risk are Quant. gender, rx, outcome are Quals for split.

    n = 602 rows, 5 columns.

    Column Inferred type Notes
    age Quant 62 unique, 0 NA
    risk Quant 10 unique, 0 NA
    gender Qual 2 unique, 0 NA
    rx Qual 2 unique, 0 NA
    outcome Qual 2 unique, 0 NA

    1.0.2 Panel B

    rx × outcome is the trial mosaic. site × outcome. Do not average rx.

    n = 602 rows, 7 columns.

    Column Inferred type Notes
    gender Qual 2 unique, 0 NA
    rx Qual 2 unique, 0 NA
    outcome Qual 2 unique, 0 NA
    pep Qual 2 unique, 0 NA
    status Qual 2 unique, 0 NA
    type Qual 4 unique, 0 NA
    site Qual 4 unique, 0 NA

    1.0.3 Panel C

    Americas-only lifeExp / gdpPercap / pop. Same join brick as other map panels.

    n = 25 rows, 6 columns.

    Column Inferred type Notes
    country Qual 25 unique, 0 NA
    continent Qual 1 unique, 0 NA
    year Quant-looking — check levels; may be Qual 1 unique, 0 NA
    lifeExp Quant 25 unique, 0 NA
    pop Quant 25 unique, 0 NA
    gdpPercap Quant 25 unique, 0 NA

    1.1 Pair card (Day 1 brick)

    Pair Legal question First mark Later test (kit first, campus later)
    Quant + Qual (2 levels) Does amount differ by kind? Two violins Two-sample comparison
    Quant + Qual (3+ levels) Do kinds have different amounts? Grouped violin ANOVA
    Qual + Qual Are kinds entangled? Mosaic Chi-square / two proportions
    One Qual vs “more than half” Is this share rare? Bar / waffle One proportion
    Same people, several conditions Do shows / conditions differ within a person? Paired boxes Repeated-measures / Friedman — not ordinary ANOVA

    1.2 Forbidden list

    • Do not histogram rx, outcome, or site.
    • Do not average treatment or gender.
    • Do not treat this RCT like an observational smoke-and-BMI table.
    • Do not choropleth population counts.
    • Do not run ANOVA on Panel B.
    • One AI prompt per panel, after paper.

    1.3 Sources

    • medicaldata::indo_rct — Elmunzer et al., RCT of rectal indomethacin for post-ERCP pancreatitis
    • gapminder 2007, Americas subset
    • Via Rdatasets (Arel-Bundock)
    Back to top

    License: CC BY-SA 2.0

    Website made with ❤️ and Quarto, by Arvind V.

    Hosted by Netlify .