View source: R/EnrichmentAnalysis.R
analyzeTable_Enrichment | R Documentation |
This function performs a chi-square test on a given contingency table and generates various diagnostic plots to assess the association between the table's dimensions. Optional plots include a balloon plot, mosaic plot, association plot, heatmap of Pearson's residuals, correlation plot of Pearson's residuals, and a plot displaying the relative contribution of Pearson's residuals.
analyzeTable_Enrichment(
tempTbl,
plotBalloon = FALSE,
plotMosaic = FALSE,
plotAssoc = FALSE,
plotResHeatmap = T,
plotCorrplot = FALSE,
plotContrib = F,
plotContrib_dir = T,
Title = ""
)
tempTbl |
A contingency table (e.g., produced by |
plotBalloon |
Logical; if |
plotMosaic |
Logical; if |
plotAssoc |
Logical; if |
plotResHeatmap |
Logical; if |
plotCorrplot |
Logical; if |
plotContrib |
Logical; if |
plotContrib_dir |
Logical; if |
Title |
Character; a title string to be used in the generated plots. |
This function requires the following packages: gplots
, pheatmap
,
vcd
, and corrplot
. Ensure these packages are installed prior to using the function.
A list containing:
test |
The chi-square test object. |
observed |
Observed counts from the contingency table. |
expected |
Expected counts, rounded to two decimal places. |
residuals |
Pearson's residuals, rounded to three decimal places. |
p.value |
The p-value of the chi-square test. |
contrib |
Relative contribution of Pearson's residuals (in percent), rounded to three decimal places. |
## Not run:
# Create an example contingency table
tempTbl <- table(sample(letters[1:3], 100, replace = TRUE),
sample(c("Low", "High"), 100, replace = TRUE))
# Analyze the table with selected plots
result <- analyzeTable_Enrichment(tempTbl,
plotBalloon = TRUE,
plotMosaic = TRUE,
plotResHeatmap = TRUE,
plotContrib = TRUE,
Title = "Example Plot Title")
# Print chi-square test results and associated metrics
print(result)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.