Tidy R programming with databases: applications with the OMOP common data model

Authors

Edward Burn

Adam Black

Berta Raventós

Yuchen Guo

Mike Du

Kim López-Güell

Núria Mercadé-Besora

Martí Català

Published

May 5, 2025

Preface

Is this book for me?

We’ve written this book for anyone interested in a working with databases using a tidyverse style approach. That is, human centered, consistent, composable, and inclusive (see https://design.tidyverse.org/unifying.html for more details on these principles).

New to R? We recommend you compliment the book with R for data science

New to databases? We recommend you take a look at some web tutorials on SQL, such as SQLBolt or SQLZoo

New to the OMOP CDM? We’d recommend you pare this book with The Book of OHDSI

How is the book organised?

The book is divided into two parts. The first half of the book is focused on the general principles for working with databases from R. In these chapters you will see how you can use familiar tidyverse-style code to build up analytic pipelines that start with data held in a database and end with your analytic results. The second half of the book is focused on working with data in the OMOP Common Data Model (CDM) format, a widely used data format for health care data. In these chapters you will see how to work with this data format using the general principles from the first half of the book along with a set of R packages that have been built for the OMOP CDM.

Citation

TO ADD

License

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Code

The source code for the book can be found at this Github repository

renv

This book is rendered using the following version of packages:

Packages Version Link
bit64 4.6.0-1 🔗
CDMConnector 2.0.0 🔗
cli 3.6.4 🔗
clock 0.7.2 🔗
CodelistGenerator 3.4.1 🔗
CohortCharacteristics 0.5.1 🔗
CohortConstructor 0.3.5 🔗
DBI 1.2.3 🔗
dbplyr 2.5.0 🔗
dm 1.0.11 🔗
dplyr 1.1.4 🔗
duckdb 1.2.1 🔗
ggplot2 3.5.1 🔗
here 1.0.1 🔗
Lahman 12.0-0 🔗
omock 0.3.2 🔗
omopgenerics 1.1.1 🔗
palmerpenguins 0.1.1 🔗
PatientProfiles 1.3.1 🔗
purrr 1.0.4 🔗
sloop 1.0.1 🔗
stringr 1.5.1 🔗
tidyr 1.3.1 🔗

Note here only the packages called explicitly are mentioned for the full list of packages and versions used see the book renv file in github.