Creates a summary table showing participant counts and person-time exposure across categories of exposure duration. The table displays both:
Number and percentage of participants in each exposure duration category
Total person-time (sum of exposure durations) for each category
By default, the table does not stratify by treatment arms. Please refer to the RMP Best Practice documents for guidance.
Total person-time is computed by summing up the exposure duration (e.g., AVAL) across all participants within each category.
The unit can be days, months or years depending on the use-case.
tbl_rmpt(
data,
variable,
aval,
by = NULL,
id = "USUBJID",
denominator,
label = "Duration of exposure"
)
# S3 method for class 'tbl_rmpt'
add_overall(
x,
last = FALSE,
col_label = "All Participants \n(N = {style_roche_number(n)})",
...
)(data.frame)
A data frame containing the exposure data. Typically ADEX dataset filtered
to one row per subject (e.g., PARAMCD == 'TDURD' and PARCAT1 == 'OVERALL').
(tidy-select)
Categorical variable defining exposure duration categories (e.g., AVAL_CAT).
This variable should be a factor with ordered levels.
(tidy-select)
Continuous variable containing exposure duration values (e.g., AVAL).
Used to calculate person-time by summing across participants.
(tidy-select)
Variable to report results by. Typically the treatment arm (e.g., TRT01A or TRTA).
Default is NULL for unstratified analysis.
(tidy-select)
String identifying the unique subjects. Default is 'USUBJID'.
(data.frame)
Data set used to compute the header counts and percentages (typically ADSL).
Should contain columns for id and by variables.
(string)
Label for the exposure duration variable that appears in the table header.
Default is "Duration of exposure".
(tbl_rmpt)
Object of class 'tbl_rmpt'.
(scalar logical)
Logical indicator to display overall column last in table.
Default is FALSE, which will display overall column first.
(string)
String indicating the column label for overall column.
Default is "All Participants \n(N = {style_roche_number(n)})".
These dots are for future extensions and must be empty.
A gtsummary table.
# Create example exposure data
df_adsl <- pharmaverseadam::adsl |> dplyr::filter(SAFFL == "Y")
df_adex <- pharmaverseadam::adex |>
dplyr::filter(PARAMCD == "TDURD", PARCAT1 == "OVERALL", SAFFL == "Y") |>
dplyr::mutate(
AVAL_MONTH = AVAL / 30.4375,
AVAL_CAT = factor(
dplyr::case_when(
AVAL_MONTH < 1 ~ "< 1 month",
AVAL_MONTH >= 1 & AVAL_MONTH < 3 ~ "1 to <3 months",
AVAL_MONTH >= 3 & AVAL_MONTH < 6 ~ "3 to <6 months",
TRUE ~ ">=6 months"
),
levels = c("< 1 month", "1 to <3 months", "3 to <6 months", ">=6 months")
)
) |>
dplyr::select(
USUBJID,
SEX,
ETHNIC,
RACE,
AGEGR1,
AVAL,
AVAL_MONTH,
AVAL_CAT,
TRT01A
)
# Example 1 --------------------------------
# Create basic RMPT table
tbl_rmpt(
data = df_adex,
variable = AVAL_CAT,
aval = AVAL,
by = TRT01A,
denominator = df_adsl
)
Participants1
Person time
Participants1
Person time
Participants1
Person time
1 n (%)
# Example 2 --------------------------------
# Add overall column at the end
tbl_rmpt(
data = df_adex,
variable = AVAL_CAT,
aval = AVAL,
by = TRT01A,
denominator = df_adsl
) |>
add_overall(last = TRUE)
Participants1
Person time
Participants1
Person time
Participants1
Person time
Participants1
Person time
1 n (%)
# Example 3 --------------------------------
# RMPT table for other variables (age group and sex), add label
tbl_rmpt(
data = df_adex,
variable = AGEGR1,
aval = AVAL,
by = SEX,
denominator = df_adsl,
label = "Treatment Exposure Duration"
)
Participants1
Person time
Participants1
Person time
1 n (%)