[R] Filtering matrices

Steve Lianoglou mailinglist.honeypot at gmail.com
Wed Aug 26 04:45:32 CEST 2009


On Tue, Aug 25, 2009 at 10:11 PM, bwgoudey<bwgoudey at gmail.com> wrote:
> I'm using the rcorr function from the Hmisc library to get pair-wise
> correlations from a set of observations for a set of attributes. This
> returns 3 matrices; one of correlations, one of the number of observations
> seen for each pair and the final of the P values for each correlation seen.
> >From these three matrices, all I wish to do is return a single matrix based
> on the first correlation matrix where each value is above a certain
> correlation, has a certain number of instances and has a P-value below some
> other threshold. My question is what is the nicest way of writing this sort
> of code?

Build some logical indexing vector against the matrix you want to pass
the criteria against, and use that on the matrix that has your values.

If you need more help, please provide three small example matrices and
let us know what you'd like your indexing to return. Someone will
provide the code to show you the correct way to do it.


Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact

More information about the R-help mailing list