contingencyTable: Create contingency Table

View source: R/enrichment-functions.R

contingencyTableR Documentation

Create contingency Table

Description

contingencyTable creates a list of 2x2 contingency tables for Fisher's exact test.

Usage

contingencyTable(x, cols, signatures, features = "rownames")

Arguments

x

A SummarizedExperiment with rowData or a data frame.

cols

A character vector containing the names of the columns (must be logical) with the target (TRUE) and reference sets (FALSE).

signatures

A named list with signature sets.

features

A character vector of length 1. In case that x is a SummarizedExperiment, this argument will be used to create the features column. In case that x is a data frame, this argument must indicate the name of the column containing the features names (taxa, genes, etc.).

Value

A list of 2x2 contingenc tables (xtabs class).

See Also

contingencyTable; enrichmentTestFisher; ora

Other enrichment functions: enrichmentTestFisher(), ora()

Examples

library(misctoolsr)
se <- exampleSE()
sigs <- exampleSignatures()
contabs <- contingencyTable(x = se, cols = c("up", "down"), signatures = sigs)
contabs

df <- as.data.frame(SummarizedExperiment::rowData(se))
contabs2 <- contingencyTable(x = df, features = "taxa", cols = c("up", "down"), signatures = sigs)



sdgamboa/misctoolsr documentation built on May 4, 2022, 12:33 p.m.