| Type: | Package |
| Title: | Clinical Trial Flow and Participant Disposition |
| Version: | 1.0.0 |
| 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>. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| Depends: | R (≥ 4.2.0) |
| Suggests: | testthat (≥ 3.0.0), spelling |
| URL: | https://github.com/vinodhpmd/TrialFlowR |
| BugReports: | https://github.com/vinodhpmd/TrialFlowR/issues |
| Language: | en-US |
| Config/testthat/edition: | 3 |
| NeedsCompilation: | no |
| Config/roxygen2/version: | 8.1.0 |
| Packaged: | 2026-09-10 15:18:58 UTC; m |
| Author: | Vinodhkumar Obli Rajendran [aut, cre], Keerthi Aaradhana [aut] |
| Maintainer: | Vinodhkumar Obli Rajendran <vinodhkumar.rajendran@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-09-18 11:40:07 UTC |
Add a participant-flow stage
Description
Adds a new participant-flow stage to an existing trial_flow object.
Usage
add_flow_stage(object, stage_name, ids = NULL)
Arguments
object |
A |
stage_name |
Name of the new stage. |
ids |
Optional participant IDs. If |
Value
An updated trial_flow object.
Examples
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)
)
x2
Count participants by flow stage and group
Description
Counts participants represented at each flow stage, optionally separated by treatment or trial group.
Usage
flow_counts(object, include_group = TRUE)
Arguments
object |
A |
include_group |
Logical; include group in the result. |
Value
A data frame of participant counts.
Examples
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)
Summarize participant disposition
Description
Summarizes participant disposition by stage, reason, and optionally treatment or trial group.
Usage
participant_disposition(data, stage, reason = NULL, group = NULL)
Arguments
data |
A participant-level data frame. |
stage |
Disposition-stage column. |
reason |
Optional reason column. |
group |
Optional treatment or trial-group column. |
Value
A data frame of disposition counts.
Examples
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"
)
Summarize participant populations
Description
Summarizes the number of participants in the overall, intention-to-treat, and per-protocol populations.
Usage
population_summary(data, itt, pp)
Arguments
data |
A participant-level data frame. |
itt |
ITT logical vector or column name. |
pp |
Per-protocol logical vector or column name. |
Value
A data frame with population counts.
Examples
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"
)
Create a clinical trial participant-flow object
Description
Creates an object representing participant flow through the stages of a clinical trial.
Usage
trial_flow(
data,
id,
stage,
group = NULL,
design = c("parallel", "crossover", "cluster", "multi-arm", "other"),
...
)
Arguments
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. |
Value
An object of class trial_flow.
Examples
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"
)
x