View source: R/rcorr_p_adjustment.R
rcorr_padjust | R Documentation |
Modifies the 'rcorr' p-values from the 'Hmisc::rcorr()' function. The result is an array with modified '$P' matrix. uses 'base::p.adjust'
rcorr_padjust(x, method = "BH")
x |
An 'rcorr' class object created by the function 'Hmisc::rcorr“ |
method |
Uses "BH" by default |
Adjust Hmisc::rcorr p-values using 'p.adjust'
An rcorr array with the following matrices:
correlation ('$r'). unchanged from the original
n ('$n'). unchanged from the original
P-value ('$P'). modified using the selected adjustment method
rcorr
, heatmaply
require(Hmisc)
require(Hmisc)
set.seed(2020) # arguably the worse seed ever
test_rcorr <- Hmisc::rcorr(matrix(runif(100), nrow = 10))
test_rcorr
# use p.adjust methods
rcorr_padjust(test_rcorr) # BH by default
rcorr_padjust(test_rcorr, method = "bonferroni") # BH by default
rcorr_padjust(test_rcorr, method = "holm") # BH by default
# SUMMARY TABLE OF RESULTS
# one unadjusted result has a low P-value (p=0.008)
method = c("none", "BH", "fdr", "holm", "hochberg", "hommel", "bonferroni", "BY")
data.frame(p.adjust.method = method,
p.adjust = map_dbl(method, ~rcorr_padjust(test_rcorr, method = .x)$P[4,5]),
txtPval = htmlTable::txtPval(map_dbl(method, ~rcorr_padjust(test_rcorr, method = .x)$P[4,5])))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.