Skip to content

R Training Resources

R is the historically preferred language of the OHDSI community, and much of the ecosystem's ready-made tooling is built in R.

HADES — OHDSI's R Package Ecosystem

HADES (Health Analytics Data-to-Evidence Suite) is a collection of open-source R packages for large-scale analytics against the OMOP CDM. Key packages include:

Package Purpose
DatabaseConnector Connect to OMOP databases (Redshift, PostgreSQL, etc.)
SqlRender Write SQL once, translate to any dialect
CohortGenerator Generate cohorts from ATLAS definitions
FeatureExtraction Extract patient-level features for modeling
PatientLevelPrediction Build and evaluate predictive models
CohortDiagnostics Evaluate cohort definitions across databases

Connecting to Emory's OMOP Data Lake from R

library(DatabaseConnector)

connectionDetails <- createConnectionDetails(
  dbms = "redshift",
  server = "<host from email>/<database from email>",
  port = 5439,
  user = "<your username>",
  password = "<your password>"
)

conn <- connect(connectionDetails)

# Query the person table
querySql(conn, "SELECT COUNT(*) AS person_count FROM cdm.person")

disconnect(conn)

Use DatabaseConnector over RPostgres

While you can connect with RPostgres or DBI directly, DatabaseConnector is recommended for OHDSI workflows because HADES packages expect a DatabaseConnector connection object.

Additional Resources