displayCrossTabs {reporttools} | R Documentation |
Function to display a set of K x C frequency tables, including p-value
Description
For each column of a dataframe, generate a LaTeX table against a given variable using displayKbyC
and add a suitable p
-value:
If the expected frequencies are all >5
then a \chi^2
-test is computed, otherwise Fisher's exact test.
Usage
displayCrossTabs(vars, v0, nam0, lab0,
percentage = c("none", "row", "col", "total")[1],
add.p = TRUE)
Arguments
vars |
Dataframe of nominal variables. |
v0 |
Nominal variable to tabulate all columns of |
nam0 |
Name of |
lab0 |
Initial string for table label. The column number of |
percentage |
Add percentages with respect to row, column, or table total. |
add.p |
Logical. If true, add |
Value
Displays LaTeX K x C tables and returns a list containing all the information.
Author(s)
Kaspar Rufibach (maintainer), kaspar.rufibach@gmail.com,
http://www.kasparrufibach.ch
Examples
set.seed(1977)
v0 <- round(runif(20, 0, 5))
v1 <- round(runif(20, 0, 3))
v2 <- round(runif(20, 0, 4))
displayCrossTabs(vars = data.frame(v1, v2), v0, nam0 = "v0", lab0 = "Q1")
[Package reporttools version 1.1.3 Index]