Internal function used by all functions that accept df_visit as a parameter. Checks for NA columns, numeric visits and AEs, implicitly missing and duplicated visits.
Examples
df_visit <- sim_test_data_study(
n_pat = 100,
n_sites = 5,
frac_site_with_ur = 0.4,
ur_rate = 0.6
)
df_visit$study_id <- "A"
df_visit_filt <- df_visit %>%
dplyr::filter(visit != 3)
df_visit_corr <- check_df_visit(df_visit_filt)
#> Warning: implicitly missing visit numbers detected and corrected
3 %in% df_visit_corr$visit
#> [1] TRUE
nrow(df_visit_corr) == nrow(df_visit)
#> [1] TRUE
df_visit_corr <- check_df_visit(dplyr::bind_rows(df_visit, df_visit))
#> Warning: Duplicated visit entries for some patients detected and corrected.
nrow(df_visit_corr) == nrow(df_visit)
#> [1] TRUE