View source: R/displayCrossTabs.r
displayCrossTabs | R Documentation |
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.
displayCrossTabs(vars, v0, nam0, lab0,
percentage = c("none", "row", "col", "total")[1],
add.p = TRUE)
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 |
Displays LaTeX K x C tables and returns a list containing all the information.
Kaspar Rufibach (maintainer), kaspar.rufibach@gmail.com,
http://www.kasparrufibach.ch
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.