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

create vignette AE #59

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion grstat.Rproj
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
Expand Down
84 changes: 84 additions & 0 deletions vignettes/ae_grade.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
title: "Adverse Event (AE)"
output:
rmarkdown::html_vignette:
number_sections: true
vignette: >
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
date: "2025-01-30"

---

<!-- https://oncostat.github.io/grstat/articles/adverse_events_sas.html -->

# Data

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

```{r setup}
library(grstat)
library(flextable)
library(dplyr)
```


```{r}
# #| label: "setup"
# #| message: false
# #| warning: false
# library(grstat)
# library(flextable)
# library(dplyr)

tm = grstat_example()
attach(tm)

head(ae)

head(enrolres)

```
# Tables Grade

create table adverse event grades by using ae_table_grade()

## Table of maximum grades per patient

```{r}
ae_table_grade(df_ae=ae, df_enrol=enrolres, arm=NULL, variant="max") %>%
as_flextable(header_show_n=TRUE) %>%
# comment tu peux changer la size des footnotes?
add_footer_lines("Percentages reflect the proportion of patients whose maximum AE grade was as indicated.")
```

## Table of maximum grades per patient by arms

```{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 presenting at most one AE of given grade")
```

## Table of all grades per patient

```{r}
ae_table_grade(df_ae=ae, df_enrol=enrolres, arm=NULL, variant="eq") %>%
as_flextable(header_show_n=TRUE) %>%
add_footer_lines("Percentages reflect the proportion of patients presenting at least one AE of given grade")
```

## Table of all grades per patient by arms

```{r}
ae_table_grade(df_ae=ae, df_enrol=enrolres, arm="arm", variant="eq") %>%
as_flextable(header_show_n=TRUE) %>%
add_footer_lines("Percentages reflect the proportion of patients presenting at least one AE of given grade")
```

Loading