you can try something like the following:
mat <- matrix(rnorm(1000), 100, 10, dimnames = list(NULL,
LETTERS[1:10]))
rcts <- rcor.test(mat)
################
rcts
pvals <- as.data.frame(rcts$p.values)
pvals$corr <- rcts$cor.mat[lower.tri(rcts$cor.mat)]
pvals[1:2] <- sapply(pvals[1:2], factor, levels = 1:ncol(mat), labels
= colnames(mat), simplify = FALSE)
pvals[c(1,2,4,3)]
I hope it helps.
Best,
Dimitris
----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http://www.student.kuleuven.be/~m0390867/dimitris.htm
----- Original Message -----
From: "Damion Colin Nero" <dcn208 at nyu.edu>
To: <r-help at stat.math.ethz.ch>
Sent: Tuesday, June 20, 2006 2:49 PM
Subject: [R] rcor.test keeping column names
>I have been using the function rcor.test in the ltm package and have
> been trying to use it for p-values of pairwise correlations using
> the
> pearson correlation . However when I call the p-values from the
> output
> it gives me back a number index instead of the row names (I
> transposed
> the columns and rows to compare genes and not columns) which shows
> up as
>
> column.number column.number p-value
>
>
>
> Is there anyway to get out an output that looks like
>
> column.name1 correlation p-value column.name2
>
> for each pairwise comparison or at least to get
>
> column.name1 column.name2 p.value
>
>
>
> Damion Nero
> Plant Molecular Biology Lab
> Department of Biology
> New York University
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm