gtreg
gtreg copied to clipboard
Add "Any AE" by Grade (feature request?)
Is it currently possible to add to a table produced by tbl_ae
the number of patients with "Any Adverse Event" by Grade (including "Any grade")? I am thinking either as an additional row in the table or in the header (with modify_header
and some magic glue
ing?).
If not, would you consider adding this feature?
Thank you for a fantastic package that has saved me so many headaches! 😀
I am so glad you find it helpful @anddis, thank you for the kind words!
I believe you are looking for the add_overall
feature? https://shannonpileggi.github.io/gtreg/reference/add_overall_tbl_ae.html Then you could modify the headers accordingly.
Does that meet your needs?
Thank you for the swift reply and for considering my request, @shannonpileggi!
Uhm, add_overall
is not quite what I am looking for, I am afraid. Apologies if my request was unclear.
I would like to display the number of subjects who had at least 1 Grade 1 AE, at least 1 Grade 2 AE, etc...
Like displaying these data in the table (using the df_adverse_events
toy dataset):
> df_adverse_events |>
+ mutate(grade = factor(grade, 1:5)) |>
+ group_by(trt, grade, .drop = FALSE) |>
+ summarise(n = length(unique(patient_id))) |>
+ pivot_wider(names_from = grade, id_cols = trt,
+ values_from = n, names_prefix = "Grade ")
`summarise()` has grouped output by 'trt'. You can override using the `.groups` argument.
# A tibble: 2 × 6
# Groups: trt [2]
trt `Grade 1` `Grade 2` `Grade 3` `Grade 4` `Grade 5`
<chr> <int> <int> <int> <int> <int>
1 Drug A 3 3 3 3 1
2 Drug B 6 6 6 7 6
But perhaps these data do not really belong in a tbl_ae
table, where the AEs are reported according to the highest grade? 🤔
Hi @anddis! Now I understand.
For now, though I could be convinced otherwise, I think that this type of summary does not belong in tbl_ae()
, but would be better suited in a different kind of summary table.
I more typically report subjects who experienced specific types of adverse events, like those who experienced a serious ae, a treatment related ae, etc. In those tables, it is again important for me to make sure the denominator represents the full cohort, and an example would be something like:
library(gtreg)
library(tidyverse)
library(gtsummary)
df_subjects <- df_adverse_events |>
mutate(
.by = patient_id,
any_grade3 = any(grade3_complication)
) |>
select(patient_id, any_grade3) |>
distinct() |>
full_join(
df_patient_characteristics,
by = "patient_id"
) |>
mutate(any_grade3 = replace_na(any_grade3, FALSE))
df_subjects |>
tbl_summary(
include = any_grade3,
by = trt,
label = list(any_grade3 ~ ">=1 Grade3+ AE")
)
Would this type of summary be of interest to you?
Hi again @anddis! This table recently came to my attention, and sounds like what you were describing. If in an FDA spec, then yes it does seem like a useful feature to add. We'll discuss.
https://pharmaverse.github.io/falcon/quarto/table-templates/template-table_09.html
Hello @shannonpileggi, thanks for getting back to me!
Yes, the table in https://github.com/shannonpileggi/gtreg/issues/211#issuecomment-1775228602 is very much like what I described. The only difference with my original request being that the number of subjects with "Any SAE" is reported by drug and not by drug and grade.
Thanks also for the suggestion (and the code!) in https://github.com/shannonpileggi/gtreg/issues/211#issuecomment-1771589361.