Skip to contents

Takes a data frame of adverse events and produces the number of events and number and percentage of individuals with an adverse event.

Usage

ae_table(df, ..., group, ID, N, accuracy = 0.1, total = FALSE)

Arguments

df

Data Frame

...

Variables to be summarised

group

Variable that defines the grouping

ID

Variable that defines the individual identifier (e.g. screening number)

N

a data frame with the group counts (typically produced using dplyr::count)

accuracy

see details of scales::percent

total

Logical indicating whether a total column should be created

Examples

  N <- dplyr::count(outcome, group, name = "N")
  ae_table(outcome_aes, serious, related, group = group, N = N, ID = screening)
#> Joining with `by = join_by(group)`
#> # A tibble: 5 × 6
#>   variable scoring A_events A_individuals B_events B_individuals
#>   <chr>    <chr>   <chr>    <chr>         <chr>    <chr>        
#> 1 NA       NA      N = 276  N = 276       N = 324  N = 324      
#> 2 serious  No      45       37 (13.4%)    45       36 (11.1%)   
#> 3 serious  Yes     4        4 (1.4%)      6        6 (1.9%)     
#> 4 related  No      47       39 (14.1%)    50       41 (12.7%)   
#> 5 related  Yes     2        2 (0.7%)      1        1 (0.3%)