-
Notifications
You must be signed in to change notification settings - Fork 0
create vignette AE #59
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
base: main
Are you sure you want to change the base?
Changes from 30 commits
7fedefc
8fd0d70
bc6b3a1
e50d185
4b0b379
410704a
ae6ff7f
f1cbd4b
dbd4c63
1a0a3e3
88b6689
7771a36
64c0f47
a61f006
063a711
32cefa0
aeec73e
9d341bc
710118a
8fecd74
8fb973c
ea3a4bc
1482801
893d51a
0258e4f
46e68fc
6dcfba1
93ca35c
e8a9d3b
dfa6942
2dd1e4a
0121783
a9cc7c0
3a530dd
20428cc
b498c91
bed5520
8e25589
c77dd91
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,4 @@ | ||
| Version: 1.0 | ||
| ProjectId: d350bac8-4795-42a0-a32d-ccb93a467950 | ||
|
|
||
| RestoreWorkspace: No | ||
| SaveWorkspace: No | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| --- | ||
| title: "Adverse Events (AE)" | ||
| output: | ||
| rmarkdown::html_vignette: | ||
| number_sections: true | ||
| vignette: > | ||
| %\VignetteEngine{knitr::rmarkdown} | ||
| %\VignetteEncoding{UTF-8} | ||
| date: "2025-01-30" | ||
| --- | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed the date, can we change the one in KM too and remove my name? I did not realise that when we done it!
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what I think about having the date, as different parts may have different update times. |
||
|
|
||
| <!-- https://oncostat.github.io/grstat/articles/adverse_events_sas.html --> | ||
|
|
||
| # Introduction | ||
|
|
||
| This tutorial demonstrates how to generate adverse event (AE) summary tables in R using the `grstat` package. AE tables are a standard tool in clinical research for evaluating the severity (grade) of events and identifying specific AE terms. | ||
|
|
||
| In this tutorial, it is demonstrated how to use two key functions: | ||
|
|
||
| - `ae_table_grade`, which creates table(s) summarising AE grades overall. | ||
|
|
||
| - `ae_table_soc`, which summarises adverse events by System Organ Class (SOC) and by grades. It reports the number and proportion of patients experiencing at least one event within each SOC, based on their maximum recorded AE grade. | ||
|
|
||
| First, install packages if needed and load them. | ||
|
|
||
| ```{r setup, message=FALSE, warning=FALSE} | ||
| library(grstat) | ||
| library(flextable) | ||
| library(dplyr) | ||
| ``` | ||
|
|
||
| # Data Overview | ||
|
|
||
| The function `grstat_example()` is used as an example dataset to illustrate the data usage. | ||
|
|
||
| This analysis focuses on two datasets: | ||
|
|
||
| - `ae`, which contains data on adverse events. | ||
|
|
||
| - `enrolres`, which includes all patients and their respective treatment arms. | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Charlotte's comment: Answer:
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Faire head ae est suffisant, je suis d'accord. |
||
| ```{r} | ||
|
|
||
| tm = grstat_example() | ||
| attach(tm) | ||
|
|
||
| head(ae, 4) | ||
|
|
||
| head(enrolres,4) | ||
|
|
||
| ``` | ||
|
|
||
| # Grade Tables only: `ae_table_grade` | ||
|
|
||
| Create adverse event (AE) grade tables using `ae_table_grade()`. | ||
|
|
||
| By default, the function `ae_table_grade` produces three table variants within a single output. | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have changed the writting as Charlotte said few times that the word "variant" is very confusing, and the reader do not know what it is about. I agree!
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commentaire de Charlotte: "On manque de précision sur le rendu global de cette fonction avant d’entrer dans les détails des « variants ». C’est une fonction qui va donner comme statistique un effectif et un pourcentage d’apparition de tel type d’AE, à tel grade, pour tel bras de traitement … " Reponse: Not sure if it needs more writing that there is already.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. C'est vrai que le terme "variant" est confusing, et du coup je suis d'accord qu'il faut plutôt d'abord décrire ce que fait la fonction par défaut. |
||
| - The most common variant is **`variant = "max"`**, which generates the table of maximum AE grade per patient, where N = total number of patients. | ||
|
|
||
| - The second variant, **`variant = "sup"`**, summarises the grades greater than or equal to a specified grade per patient, where n is the number of patients having experienced at least one AE of grade higher or equal to X. | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. J ai rajoute " ≥ X, where X ∈ {1, 2, 3, 4, 5}." parce que charlotte le suggereait plus ou moins dans une de ces commentaire; "Quel argument permet de fixer le X d’intérêt? ". le max grade en oncology c est bien 5?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Le max c'est 5 partout, pas juste en oncologie. BTW, je ne suis pas sûr de "most common", ça dépend des pratiques des uns et des autres, des journaux, etc. |
||
| - The third variant, **`variant = "eq"`**, presents all grades for all patients. In this table, each proportion represents the number of patients who experienced a given grade at least once, where n is the number of patients having experienced at least one AE of grade equal to X. | ||
|
|
||
| ## Default AE Table Grades - incuding All Variants (Max, Sup, Eq) | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Charlotte Commentaires: Ok sur le rendu par défaut mais mérite d’être plus clair avant. Par ailleurs, est-ce qu’il n’y a pas un moyen d’avoir des noms de colonne plus jolis et standards que « label », « variable », « treatment arm » tout en ayant « all patients » juste en dessous… dans les MACRO SAS les majuscules/minuscules et noms de colonnes étaient un peu plus soignés. Il faut voir comment modifier ces noms de colonnes de tableaux voir les supprimer sauf quand il y a les bras de traitements et des effectifs.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. C'est une bonne remarque ! |
||
| ```{r} | ||
| ae_table_grade(df_ae=ae, df_enrol=enrolres) %>% | ||
| as_flextable(header_show_n=TRUE) %>% | ||
| fontsize(size = 8, part = "all") %>% | ||
| padding(padding.top=0, padding.bottom=0) | ||
| ``` | ||
|
|
||
| ## Custom table of maximum AE grade per patient per arm | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Charlotte comment: Préciser que arm = “arm” signifie que le bras de traitement a pour nom de variable “arm” et est issu du data frame “enrolres”.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure either |
||
| As an extra example of AE grade table, a table of maximum grade per patient and per arm (i.e. variant = "max") is also presented. | ||
|
|
||
| ```{r} | ||
| ae_table_grade(df_ae=ae, df_enrol=enrolres, arm="arm", variant="max") %>% | ||
| as_flextable(header_show_n=TRUE) %>% | ||
| add_footer_lines("Percentages reflect the proportion of patients whose maximum AE grade was as indicated per given arm.") %>% | ||
| fontsize(size = 8, part = "all") %>% | ||
| padding(padding.top=0, padding.bottom=0) | ||
| ``` | ||
|
|
||
| # SOC's tables: `ae_table_soc` | ||
|
|
||
| The function ae_table_soc() creates a summary table of AE grades for each patient according to AE term and SOC CTCAE. The resulting dataframe can be piped to as_flextable() to get a nicely formatted flextable. | ||
|
|
||
| ## Table of AE grades by SOC | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Charlotte: La colonne s’appelle “Total” (texte) ou “Tot » (sur la sortie R) ? Answer: pour montrer la difference entre la table 4.1 et table 4.2
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A la base, j'avais mis Tot pour que ce soit aussi court que "G5", surtout dans les tables très larges. |
||
| This table summarises the distribution of adverse event grades by System Organ Class (SOC). You can add total = FALSE to remove the “Total” column. | ||
|
|
||
| ```{r} | ||
| ae_table_soc(df_ae=ae, df_enrol=enrolres, arm=NULL, term=NULL, | ||
| sort_by_count=FALSE) %>% | ||
| head(10) %>% | ||
| as_flextable() %>% | ||
DanChaltiel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| add_footer_lines("In the header, N represents the number of patients.") %>% | ||
| add_footer_lines("Percentages reflect the proportion of patients whose maximum AE grade was as indicated.") | ||
| ``` | ||
|
|
||
|
|
||
| ## Table of SOC and AE terms, all grades combined, stratified by arm | ||
|
|
||
| Presents SOC and Preferred Term frequencies with all AE grades combined, stratified by treatment arm. Provides an overall summary of event occurrence per arm, regardless of grade. | ||
|
|
||
| ```{r} | ||
DanChaltiel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ae_table_soc(df_ae=ae, df_enrol=enrolres, arm="arm", term="aeterm", | ||
| sort_by_count=FALSE) %>% | ||
| head(10) %>% | ||
| as_flextable() %>% | ||
| add_footer_lines("In the header, N represents the number of patients.") %>% | ||
| add_footer_lines("Percentages reflect the proportion of patients whose maximum AE grade was as indicated.") | ||
| ``` | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Charlotte's comment: Pas d’indication sur les autres manières de reporter les AEs ? Filtre sur les SAEs ? Filtre sur les AEs reliés au traitement ? Answer: je suis pas sur qu on devrait rallonger la vignette peu etre mais pas pour le moment, comme on avait dit pour les TEAE. enssuite le fait de faire la liste de tout les elments de la function ca c est dan la help, right?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oui c'est dans le help. |
||
Uh oh!
There was an error while loading. Please reload this page.