[R] running rcorr (Hmisc) on multiple cores

R Tagett rtt at wayne.edu
Sat Feb 21 05:51:07 CET 2015


Hello,

I am having trouble generating a correlation matrix on multiple cores.

I have a matrix "myMat" for which I would like to do a Pearson correlation. 
Lets say dim(myMat) is 100 200. I want a 200x200 correlation matrix and corresponding p-value matrix.

I like to use rcorr(myMat) in the Hmisc package, but for larger matrices this command is too time consuming.
I have spent a day playing with mclapply(myMat, rcorr, ...) from the parallel package, trying to distribute the job on multiple cores. But I can't figure it out.

I also tried mclapply( myMat, cor.test, ...), but it runs even more slowly.

Does anyone have any suggestions?

Thanks very much for your help,
Beck



More information about the R-help mailing list