Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "Any AE" by Grade (feature request?) #211

Open
anddis opened this issue Sep 14, 2023 · 5 comments
Open

Add "Any AE" by Grade (feature request?) #211

anddis opened this issue Sep 14, 2023 · 5 comments

Comments

@anddis
Copy link

anddis commented Sep 14, 2023

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 glueing?).

If not, would you consider adding this feature?

Thank you for a fantastic package that has saved me so many headaches! 😀

@shannonpileggi
Copy link
Owner

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?

@anddis
Copy link
Author

anddis commented Sep 14, 2023

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? 🤔

@shannonpileggi
Copy link
Owner

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")
  )

image

Would this type of summary be of interest to you?

@shannonpileggi
Copy link
Owner

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

image

@anddis
Copy link
Author

anddis commented Oct 23, 2023

Hello @shannonpileggi, thanks for getting back to me!

Yes, the table in #211 (comment) 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 #211 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants