Skip to contents

Internal function called by sim_sites. Collect AEs per patient at visit_med75 for site and study as a vector of integers.

Usage

prep_for_sim(df_site, df_visit)

Arguments

df_site

dataframe created by site_aggr

df_visit

dataframe, created by sim_sites

Value

dataframe

Examples

df_visit <- sim_test_data_study(
   n_pat = 100,
   n_sites = 5,
   frac_site_with_ur = 0.4,
   ur_rate = 0.2
)

df_visit$study_id <- "A"

df_site <- site_aggr(df_visit)

df_prep <- prep_for_sim(df_site, df_visit)
df_prep
#> # A tibble: 5 × 7
#>   study_id site_number n_pat n_pat_with_med75 visit_med75 n_ae_site  n_ae_study
#>   <chr>    <chr>       <int>            <dbl>       <dbl> <list>     <list>    
#> 1 A        S0001          20               18          15 <int [18]> <int [71]>
#> 2 A        S0002          20               16          16 <int [16]> <int [64]>
#> 3 A        S0003          20               19          15 <int [19]> <int [70]>
#> 4 A        S0004          20               18          14 <int [18]> <int [73]>
#> 5 A        S0005          20               17          15 <int [17]> <int [72]>