Hi, #data: dat1 mat1<-matrix(dat1[,2],ncol=3,nrow=7) colnames(mat1)<-unique(dat1[,1]) library(Hmisc) rcorr(mat1)$P # TTK CTJ PKR #TTK NA 0.0151874 0.6277163 #CTJ 0.0151874 NA 0.5214368 #PKR 0.6277163 0.5214368 NA A.K.
----- Original Message ----- From: Nico Met <nicome...@gmail.com> To: R help <r-help@r-project.org> Cc: Sent: Wednesday, February 13, 2013 6:13 AM Subject: [R] Correlation with p value Dear all, I have a data (bellow) and I want to make a correlation test with p-value structure(list(Name = structure(c(3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("CTJ", "PKR", "TTK"), class = "factor"), score = c(86.4371428571428, 89.7028571428572, 87.728, 89.99, 89.42, 85.6914285714286, 82.256, 83.9942857142857, 86.4371428571429, 84.596, 84.74, 87.8771428571428, 83.12, 81.824, 88.5457142857143, 85.7171428571429, 84.902, 89.8828571428571, 91.5542857142857, 89.42, 86.81)), .Names = c("Name", "score"), class = "data.frame", row.names = c(NA, 21L)) And finally , I would like to display as matrix where I can fill up with p-values *TTK* *CTJ* *PKR* *TTK* ** ** ** *CTJ* ** ** ** *PKR* Many thanks for your help in advance Nico [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.