| Title: | Clinical Trial Flow and Participant Disposition |
|---|---|
| Description: | Summarizes participant flow and disposition in clinical trials, including CONSORT-style randomized controlled trials, parallel-group, crossover, cluster randomized, and multi-arm trials. Provides functions for screening failures, exclusions and reasons, allocation, follow-up, loss to follow-up, withdrawals, intention-to-treat and per-protocol populations, and participant-disposition summaries. The methods are based on established principles for reporting participant flow and disposition in randomized trials; see Schulz et al. (2010) <doi:10.1136/bmj.c332>. |
| Authors: | Vinodhkumar Obli Rajendran [aut, cre], Keerthi Aaradhana [aut] |
| Maintainer: | Vinodhkumar Obli Rajendran <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.0 |
| Built: | 2026-09-18 16:48:32 UTC |
| Source: | https://github.com/cran/TrialFlowR |
Adds a new participant-flow stage to an existing trial_flow object.
add_flow_stage(object, stage_name, ids = NULL)add_flow_stage(object, stage_name, ids = NULL)
object |
A |
stage_name |
Name of the new stage. |
ids |
Optional participant IDs. If |
An updated trial_flow object.
dat <- data.frame( id = 1:4, stage = c("Screened", "Screened", "Randomized", "Randomized"), group = c("A", "B", "A", "B") ) x <- trial_flow( dat, id = "id", stage = "stage", group = "group" ) x2 <- add_flow_stage( x, stage_name = "Completed", ids = c(3, 4) ) x2dat <- data.frame( id = 1:4, stage = c("Screened", "Screened", "Randomized", "Randomized"), group = c("A", "B", "A", "B") ) x <- trial_flow( dat, id = "id", stage = "stage", group = "group" ) x2 <- add_flow_stage( x, stage_name = "Completed", ids = c(3, 4) ) x2
Counts participants represented at each flow stage, optionally separated by treatment or trial group.
flow_counts(object, include_group = TRUE)flow_counts(object, include_group = TRUE)
object |
A |
include_group |
Logical; include group in the result. |
A data frame of participant counts.
dat <- data.frame( id = 1:6, stage = c( "Screened", "Screened", "Randomized", "Randomized", "Completed", "Completed" ), group = c("A", "B", "A", "B", "A", "B") ) x <- trial_flow( dat, id = "id", stage = "stage", group = "group" ) flow_counts(x)dat <- data.frame( id = 1:6, stage = c( "Screened", "Screened", "Randomized", "Randomized", "Completed", "Completed" ), group = c("A", "B", "A", "B", "A", "B") ) x <- trial_flow( dat, id = "id", stage = "stage", group = "group" ) flow_counts(x)
Summarizes participant disposition by stage, reason, and optionally treatment or trial group.
participant_disposition(data, stage, reason = NULL, group = NULL)participant_disposition(data, stage, reason = NULL, group = NULL)
data |
A participant-level data frame. |
stage |
Disposition-stage column. |
reason |
Optional reason column. |
group |
Optional treatment or trial-group column. |
A data frame of disposition counts.
dat <- data.frame( stage = c( "Screened", "Excluded", "Randomized", "Withdrawn" ), reason = c( NA, "Ineligible", NA, "Adverse event" ), group = c( NA, NA, "Treatment", "Treatment" ) ) participant_disposition( dat, stage = "stage", reason = "reason", group = "group" )dat <- data.frame( stage = c( "Screened", "Excluded", "Randomized", "Withdrawn" ), reason = c( NA, "Ineligible", NA, "Adverse event" ), group = c( NA, NA, "Treatment", "Treatment" ) ) participant_disposition( dat, stage = "stage", reason = "reason", group = "group" )
Summarizes the number of participants in the overall, intention-to-treat, and per-protocol populations.
population_summary(data, itt, pp)population_summary(data, itt, pp)
data |
A participant-level data frame. |
itt |
ITT logical vector or column name. |
pp |
Per-protocol logical vector or column name. |
A data frame with population counts.
dat <- data.frame( id = 1:6, itt = c(TRUE, TRUE, TRUE, TRUE, TRUE, FALSE), pp = c(TRUE, TRUE, TRUE, FALSE, TRUE, FALSE) ) population_summary( dat, itt = "itt", pp = "pp" )dat <- data.frame( id = 1:6, itt = c(TRUE, TRUE, TRUE, TRUE, TRUE, FALSE), pp = c(TRUE, TRUE, TRUE, FALSE, TRUE, FALSE) ) population_summary( dat, itt = "itt", pp = "pp" )
Creates an object representing participant flow through the stages of a clinical trial.
trial_flow( data, id, stage, group = NULL, design = c("parallel", "crossover", "cluster", "multi-arm", "other"), ... )trial_flow( data, id, stage, group = NULL, design = c("parallel", "crossover", "cluster", "multi-arm", "other"), ... )
data |
A data frame with one row per participant. |
id |
Participant identifier column. |
stage |
Flow-stage column. |
group |
Optional treatment or trial-group column. |
design |
Trial design. |
... |
Additional arguments. |
An object of class trial_flow.
dat <- data.frame( id = 1:6, stage = c( "Screened", "Screened", "Randomized", "Randomized", "Completed", "Completed" ), group = c("A", "B", "A", "B", "A", "B") ) x <- trial_flow( dat, id = "id", stage = "stage", group = "group", design = "parallel" ) xdat <- data.frame( id = 1:6, stage = c( "Screened", "Screened", "Randomized", "Randomized", "Completed", "Completed" ), group = c("A", "B", "A", "B", "A", "B") ) x <- trial_flow( dat, id = "id", stage = "stage", group = "group", design = "parallel" ) x