diff --git a/R/data_chisq.R b/R/data_chisq.R new file mode 100644 index 000000000..636f87bea --- /dev/null +++ b/R/data_chisq.R @@ -0,0 +1,15 @@ +#' Calculate chi square test for tabulate +#' +#' @param dwtable A dwtable object. +#' @param show_table Should the table be shown with the chi sqare +#' @param ... Other options +#' +#' @export +data_chisq <- function(dwtable, show_table = TRUE, ...) { + tablelist <- as.table(dwtable) + chisqlist <- lapply(tablelist, stats::chisq.test) + if (length(chisqlist) == 1) { + return(chisqlist[[1]]) + } + chisqlist +}