Learn R Programming

Deducer (version 0.7-9)

contingency.tables: Contingency Tables

Description

Creates a contingency.tables object

Usage

contingency.tables(row.vars, col.vars, stratum.var, data=NULL, missing.include=FALSE )

Arguments

row.vars
A variable or data frame evaluated in data
col.vars
A variable or data frame evaluated in data
stratum.var
A variable evaluated in data
data
A data.frame
missing.include
A logical indicating whether a missing category should be included in the table

Value

A list with class "contingency.tables." Each element of the list is a single contingency table of class "contin.table" corresponding to each combination of elements of row.vars and col.vars stratified by stratum.var

See Also

extract.counts

Examples

Run this code
temp.data<-data.frame(a=rnorm(100)>0,b=rnorm(100)>0,gender=rep(c("male","female"),50))
#a vs. b stratified by gender
tab<-contingency.tables(a,b,gender,data=temp.data)
tab

##add in chi-squared tests
tab<-add.chi.squared(tab)
tab

Run the code above in your browser using DataLab