Learn R Programming

Deducer (version 0.9-1)

contingency.tables: Contingency Tables

Description

Creates a contingency.tables object

Usage

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

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

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

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