Learn R Programming

ds (version 4.0)

tables: Tables of Categorical Variables

Description

Organizes various tables of categorical variables and tests tables (Chi-square and Fisher's exact test)

Usage

tables(data)

Arguments

data

data is a data.frame

See Also

gds, dscor, dplot

Examples

Run this code
# NOT RUN {
treatments=gl(2, 30, labels = c("Control", "Treat"))
resultsA=rep(c("positive","negative", "positive","negative"),c(25,5,7,23))
resultsB=rep(c("positive","negative", "positive","negative"),c(28,2,8,22))
resultsC=rep(c("positive","negative", "positive","negative"),c(16,14,13,17))

data=data.frame(treatments,resultsA, resultsB, resultsC)

r=tables(data)

names(r)

r

r[1]
r[2]
r[6]

# }

Run the code above in your browser using DataLab