Am new to R language and packages.To pairwise pearson correlation analysis of about 9000 genes in a matrix format, I used psych package in R following the info from the link here
However, I face some problem in analysis which could not be solved using the psych manual.
First one: a general error "Error in cor(x, use = use, method = method) : 'x' must be numeric" . When I remove the element names and kept only the values, it works. How can I include the header as well?The following code showed the above error
library("psych")
myData <- read.clipboard.tab(header = TRUE)
corr.test(myData)
My second doubt: What is the best method to filter pairs having pearson correlation >=0.5? I mean I should do it separately or there any method in R itself?
edit:
name experiment1 experiment2 experiment3
gene1 -0.05814212 -0.3844461 1.4553193
gene2 -0.22045895 0.43413392 1.774345
gene3 1.4845127 -2.4423246 0.37565866
gene4 2.4195287 2.6537158 2.6640055
myData1 <- myData[-1]; rownames(myData1) <- myData[,1]
– akruncorr.test(myData)
, you are comparing the columns with each other. I don't know how you want to retain the gene names. Can you show the expected format. Do you needcorr.test(t(myData1))
? Here,myData1
is based on my previous comment – akrun