Learn R Programming

EHR (version 0.4-11)

zeroOneTable: Make Zero One Contingency Tables

Description

Make contingency tables for many binary outcomes and a binary covariate

Usage

zeroOneTable(EXPOSURE, phenotype)

Value

t00

frequency for non-exposed group and non-case outcome.

t01

frequency for non-exposed group and case outcome.

t10

frequency for exposed group and non-case outcome.

t11

frequency for exposed group and case outcome.

Arguments

EXPOSURE

binary covariate (e.g., exposure).

phenotype

binary outcome (e.g., phenotype).

Author

Leena Choi leena.choi@vanderbilt.edu and Cole Beck cole.beck@vumc.org

Details

Generates frequency and contingency tables for many binary outcomes (e.g., large number of phenotypes) and a binary covariate (e.g., drug exposure, genotypes) more efficiently.

Examples

Run this code
## full example data
data(dataPheWAS)
demo.covariates <- c('id','exposure','age','race','gender')
phenotypeList <- setdiff(colnames(dd), demo.covariates)
tablePhenotype <- matrix(NA, ncol=4, nrow=length(phenotypeList), 
dimnames=list(phenotypeList, c("n.nocase.nonexp", "n.case.nonexp", 
"n.nocase.exp", "n.case.exp")))
for(i in seq_along(phenotypeList)) {
    tablePhenotype[i, ] <- zeroOneTable(dd[, 'exposure'], dd[, phenotypeList[i]])
}

Run the code above in your browser using DataLab