add.tables: Add stat table to an existing contingency table

View source: R/add.tables.R

add.tablesR Documentation

Add stat table to an existing contingency table

Description

Add stat table to an existing contingency table

Usage

add.tables(x, format = NULL, ...)

Arguments

x

A crosstable object

format

Character vector with the format of the stats. See help("%f%")

...

A list of tables. They must have the same dimensions of the original table.

Examples

library(magrittr)

bacteria <- MASS::bacteria

tab <- xtabs(~y+trt, data=bacteria)
tab_chsq <- chisq.test(tab)

crosstable(tab) %>%
  add.tables(format=c("0.00%", "(0.00)"), "%" = prop.table(tab)*100, "expected" = tab_chsq$expected)


andresnecochea/multitabulation documentation built on June 15, 2022, 5:55 a.m.