[R] Converting matrix data to a list

Ivan Calandra ivan.calandra at uni-hamburg.de
Fri Nov 19 12:31:01 CET 2010


Hi,

Not sure how since I never use it, but I think melt() and then cast() 
from the reshape (or reshape2?) package are designed for this kind of 
transformations

Ivan

Le 11/19/2010 12:08, Adam Streline a écrit :
> Hi, I've looked through the posts but couldn't find a solution to this. I'd be
> really grateful if someone could help,
>
> I'd like to convert a data file of mutual information that is formatted as
> a matrix:
>
>              TF1    TF2    TF3    TF200...
> Gene1    0.0    0.2    0.2
> Gene2    1.4    0.0    2.8
> Gene3    0.3    0.6    1.7
> Gene6000....
>
> To a list:
>
> Gene1    TF1    0.0
> Gene1    TF2    0.2   
> Gene1    TF3    0.2
> Gene2    TF1    1.4
> Gene2    TF2    0.0
> Gene2    TF3    2.8
> Gene3    TF1    0.3
> Gene3    TF2    0.6
> Gene3    TF3    1.7
> Gene6000...TF200...etc
>
> The matrix is ~6000X200 in size,
>
> Adam
>
>
>
> 	[[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.

-- 
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calandra at uni-hamburg.de

**********
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/1525_8_1.php



More information about the R-help mailing list