[R] Pairwise correlation

Peter Langfelder peter.langfelder at gmail.com
Wed Nov 16 20:27:43 CET 2011


On Wed, Nov 16, 2011 at 8:37 AM, muzz56 <musahass at gmail.com> wrote:
> Dear All,
> I am not familiar with R yet I want to use it to perform some task, hence my
> posting here. I hope someone can help.
> I have a set of data, genes (rows) and samples (columns). I want to do a
> Pearson correlation on all the possible pairwise combinations of all the
> genes (2000). Does anyone have an idea of how to execute this in R?

Put the expression data in a matrix called expression

Then simply execute

correlations = cor(t(expression))

If you have missing data, use

correlations = cor(t(expression), use = 'p')

HTH

Peter



More information about the R-help mailing list