zeroOneTable {EHR}R Documentation

Make Zero One Contingency Tables

Description

Make contingency tables for many binary outcomes and a binary covariate

Usage

zeroOneTable(EXPOSURE, phenotype)

Arguments

EXPOSURE

binary covariate (e.g., exposure).

phenotype

binary outcome (e.g., phenotype).

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.

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.

Author(s)

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

Examples

## 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]])
}

[Package EHR version 0.4-11 Index]