R/prop_test_tbl.R

Defines functions prop_test_tbl

prop_test_tbl <- function(counts,trials,comp_name,data_compared,sig_thresh = 0.05) {

require(tidyverse)
require(purrr)

x <- prop.test(counts,trials,conf.level = 1 - sig_thresh)

tbl <- tibble(comparison = comp_name,
              metric = data_compared,
              p_value = x$p.value,
              stat_sig  = p_value < sig_thresh,
              x_mean = x$estimate[1],
              y_mean = x$estimate[2],
              conf_int_low = x$conf.int[1],
              conf_int_high = x$conf.int[2],
              statistic = x$statistic,
              parameter = x$parameter,
              null_value = ifelse(is_empty(x$null.value)==TRUE,'NULL',x$null.value),
              alternative = x$alternative,
              method = x$method)

  return(tbl)
}
neugelb/neugelbtools documentation built on July 7, 2020, 1:17 a.m.