View source: R/enrichment_funks.R
generateContingencyTable | R Documentation |
Generates a matrix that can directly be used as input for hypothesis testing, e.g. with base::fisher.test(...). Validates the resulting table based on the input data. Validation checks whether the intersections of elements having attribute A and B and those having attribute A and NOT B truly form the whole set of all elements with attribute A. The same validation is done for the other rows and columns. Error-Codes are: 1 - row.1 does not fully separate into col.1 and col.2 2 - row.2 does not fully separate into col.1 and col.2 3 - col.1 does not fully separate into row.1 and row.2 4 - col.2 does not fully separate into row.1 and row.2 5 - the sum of all cells sizes in the contingency table is not identical to the size of the mathematical set of all elements contained in both rows and columns (row.1, row.2, col.1, col.2).
generateContingencyTable(row.1, row.2, col.1, col.2, row.category,
col.category, categories = c("T", "F"), validate = TRUE)
row.1 |
a vector of elements that have attribute A |
row.2 |
a vector of elements that do not have attribute A |
col.1 |
a vector of elements that have attribute B |
col.2 |
a vector of elements that do not have attribute B |
row.category |
the name of attribute A true for elements in row.1 and false for elements in row.2 |
col.category |
the name of attribute B true for elements in col.1 and false for elements in col.2 |
categories |
default is 'T' and 'F' indicating whether row.1 and col.1 indicate elements that have attribute A, and elements in row.2 and col.2 do not have the respective attribute. |
validate |
set to FALSE, if validation is not wanted. Default is TRUE |
A 2 x 2 contingency table.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.