[R] How to make this binary hit matrix

From: ssls sddd <ssls.sddd_at_gmail.com>
Date: Sun, 15 Jun 2008 13:49:28 -0400

Hi all,

Basically I want to make a binary hit matrix.

For instance, if I have a file called 'pair.txt':

set_a    gene_1
set_a    gene_2
set_a    gene_3
set_b    gene_3
set_b    gene_4
set_b    gene_5
set_c    gene_1
set_c    gene_3

And I want to convert it to a binary matrix as:

Rows set_a set_b set_c

gene_1    1    0    1
gene_2    1    0    0
gene_3    1    1    1
gene_4    0    1    0
gene_5    0    1    0

Can anyone suggest how to do this?

Thank you!

Alex

        [[alternative HTML version deleted]]



R-help_at_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. Received on Sun 15 Jun 2008 - 17:51:48 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 15 Jun 2008 - 18:30:40 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive