
Building Cohorts with STROBE Diagrams
Source:vignettes/building-cohort-with-strobe.Rmd
building-cohort-with-strobe.Rmd
Introduction
The STROBE (Strengthening the Reporting of Observational Studies in
Epidemiology) statement provides guidelines for reporting observational
studies. A key component is the flow diagram that shows how the study
population was selected. We encourage use of the companion
strobe
package, which provides tools to create
STROBE-compliant flow diagrams while building your cohort.
This vignette demonstrates how to use the strobe
functions via the standalone strobe
package to:
- Initialize a cohort with inclusion criteria
- Apply sequential filters with exclusion tracking
- Generate and customize STROBE flow diagrams
- Review the complete filtering log
For more details, visit the strobe
package website.
Installation
You can install the development version of the sRtr
package from GitHub using devtools
or pak
:
# Install devtools if needed
install.packages("devtools")
# Install sRtr (and strobe, a suggested package)
devtools::install_github("VagishHemmige/sRtr", dependencies = TRUE)
Basic STROBE Workflow
The STROBE workflow in strobe
follows these steps:
-
Initialize the cohort with
strobe_initialize()
-
Filter sequentially with
strobe_filter()
-
Plot the diagram with
plot_strobe_diagram()
-
Review the log with
get_strobe_log()
Example: Kidney Transplant Cohort
Let’s build a cohort of kidney transplant recipients with specific criteria:
TX_KI %>%
strobe::strobe_initialize(inclusion_label = "All kidney transplants") %>%
strobe::strobe_filter(
condition = "DON_AGE > 18",
inclusion_label = "Donor over 18 years old",
exclusion_reason = "Excluded: Donor age ≤ 18"
) %>%
strobe::strobe_filter(
condition = "DON_ABO == 'B'",
inclusion_label = "Donor blood type B",
exclusion_reason = "Excluded: Donor blood type is not B"
) %>%
strobe::strobe_filter(
condition = "REC_AGE >= 18 & REC_AGE <= 65",
inclusion_label = "Recipient age 18-65",
exclusion_reason = "Excluded: Recipient age outside 18-65 range"
)
Reviewing the Filtering Log
# View the complete filtering log
strobe::get_strobe_log()
The log shows: - Each filtering step - Number of records included/excluded at each step - Cumulative counts - Exclusion reasons
Creating STROBE Diagrams
strobe::plot_strobe_diagram(
incl_width_min = 3,
incl_height = 1,
excl_width_min = 2.5,
excl_height = 1,
lock_width_min = TRUE,
lock_height = TRUE,
incl_fontsize = 16,
excl_fontsize = 14
)
For more details, see the separate documentation of the
strobe
package.