co-expression output format(rcorr.adjust)
Dear All
I want use "rcorr.adjust" (https://rdrr.io/cran/RcmdrMisc/man/rcorr.adjust.html) for gene co-expression analysis but I want to have a the output in one table contain rows , columns name , correlation , P-value and adjust P
any help?
output of rcorr.adjust :
Eucgr.A00001.v2.0 Eucgr.A00003.v2.0 Eucgr.A00004.v2.0
Eucgr.A00001.v2.0 1.0000 0.1926 0.7389
Eucgr.A00003.v2.0 0.1926 1.0000 -0.0559
Eucgr.A00004.v2.0 0.7389 -0.0559 1.0000
Number of observations: 12
Pairwise two-sided p-values:
Eucgr.A00001.v2.0 Eucgr.A00003.v2.0 Eucgr.A00004.v2.0
Eucgr.A00001.v2.0 0.5487 0.0060
Eucgr.A00003.v2.0 0.5487 0.8631
Eucgr.A00004.v2.0 0.0060 0.8631
Adjusted p-values (Holm's method)
Eucgr.A00001.v2.0 Eucgr.A00003.v2.0 Eucgr.A00004.v2.0
Eucgr.A00001.v2.0 1.0000 0.0181
Eucgr.A00003.v2.0 1.0000 1.0000
Eucgr.A00004.v2.0 0.0181 1.0000
Expected output:
row column cor P-value padj
Eucgr.A00001.v2.0 Eucgr.A00003.v2.0 0.1926 0.5487 1.0000
• 1,869 views
•
link
1 answer
In such cases, use str() to check the structure of the object then extracts the bits you need. Once we know the structure of the resulting object, we could do something like below, of course this needs more tinkering to get the output you need, this is just a start:
# using example from the manuals
library(car)
library(RcmdrMisc)
data(Mroz)
res <- rcorr.adjust(Mroz[,c("k5", "k618")])
str(res)
cbind(res$R$r, res$P, res$P.unadj)
# k5 k618 k5 k618 k5 k618
# k5 "1" "0.084159872381097" "" "0.0209" "" "0.0209"
# k618 "0.084159872381097" "1" "0.0209" "" "0.0209" ""
• 1 views
•
link
Log in to answer this question.