R/fix_df.R

Defines functions fix_df

Documented in fix_df

#' Fix the strata so they all have at least one case and control
#'
#' @param d A stratified dataset
fix_df <- function(d) {
        d %>% group_by(strata) %>%
        left_join(summarize(., nsubj = n()), by = "strata") %>%
        filter(nsubj > 1) %>% select(-nsubj) %>%
        ## finalize and filter
        ungroup %>% arrange(strata, dist)
}

Try the nncc package in your browser

Any scripts or data that you put into this service are public.

nncc documentation built on May 29, 2024, 5:05 a.m.