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)})",
  ...
)

Arguments

data

(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').

variable

(tidy-select)
Categorical variable defining exposure duration categories (e.g., AVAL_CAT). This variable should be a factor with ordered levels.

aval

(tidy-select)
Continuous variable containing exposure duration values (e.g., AVAL). Used to calculate person-time by summing across participants.

by

(tidy-select)
Variable to report results by. Typically the treatment arm (e.g., TRT01A or TRTA). Default is NULL for unstratified analysis.

id

(tidy-select)
String identifying the unique subjects. Default is 'USUBJID'.

denominator

(data.frame)
Data set used to compute the header counts and percentages (typically ADSL). Should contain columns for id and by variables.

label

(string)
Label for the exposure duration variable that appears in the table header. Default is "Duration of exposure".

x

(tbl_rmpt)
Object of class 'tbl_rmpt'.

last

(scalar logical)
Logical indicator to display overall column last in table. Default is FALSE, which will display overall column first.

col_label

(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.

Value

A gtsummary table.

Examples

# 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
)
Duration of exposure
Placebo
(N = 86)
Xanomeline High Dose
(N = 72)
Xanomeline Low Dose
(N = 96)
Participants1 Person time Participants1 Person time Participants1 Person time
< 1 month 9 (10.5%) 150 5 (6.9%) 100 33 (34.4%) 447
1 to <3 months 10 (11.6%) 553 29 (40.3%) 1,560 23 (24.0%) 1,354
3 to <6 months 27 (31.4%) 4,517 18 (25.0%) 2,692 19 (19.8%) 2,504
>=6 months 40 (46.5%) 7,491 20 (27.8%) 3,728 21 (21.9%) 3,942
Total 86 (100%) 12,711 72 (100%) 8,080 96 (100%) 8,247
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)
Duration of exposure
Placebo
(N = 86)
Xanomeline High Dose
(N = 72)
Xanomeline Low Dose
(N = 96)
All Participants
(N = 254)
Participants1 Person time Participants1 Person time Participants1 Person time Participants1 Person time
< 1 month 9 (10.5%) 150 5 (6.9%) 100 33 (34.4%) 447 47 (18.5%) 697
1 to <3 months 10 (11.6%) 553 29 (40.3%) 1,560 23 (24.0%) 1,354 62 (24.4%) 3,467
3 to <6 months 27 (31.4%) 4,517 18 (25.0%) 2,692 19 (19.8%) 2,504 64 (25.2%) 9,713
>=6 months 40 (46.5%) 7,491 20 (27.8%) 3,728 21 (21.9%) 3,942 81 (31.9%) 15,161
Total 86 (100%) 12,711 72 (100%) 8,080 96 (100%) 8,247 254 (100%) 29,038
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" )
Treatment Exposure Duration
F
(N = 143)
M
(N = 111)
Participants1 Person time Participants1 Person time
18-64 19 (13.3%) 2,461 14 (12.6%) 1,520
>64 124 (86.7%) 13,970 97 (87.4%) 11,087
Total 143 (100%) 16,431 111 (100%) 12,607
1 n (%)