[BioC] Converting list to a matrix

Carlos J. Gil Bellosta cgb at datanalytics.com
Tue Apr 12 15:31:26 CEST 2011


If you want it transpose, use cbind instead of rbind.

Best regards,

Carlos J. Gil Bellosta
http://www.datanalytics.com

2011/4/12 Pankaj Barah <pankajborah at gmail.com>:
> Thanks Carlos,
>
> It worked. I had to transpose it. t(do.call( rbind, a ))
>
> Thanks a lot,
>
> Pankaj
>
> On Tue, Apr 12, 2011 at 3:09 PM, Carlos J. Gil Bellosta
> <cgb at datanalytics.com> wrote:
>>
>> Hello,
>>
>> Try this:
>>
>> a <- list( a = 1:4, b = 2:5 )
>> do.call( rbind, a )
>>
>> Mind that not all your list entries seem to have 30800 variables. Some
>> seem to be shorter.
>>
>> Best regards,
>>
>> Carlos J. Gil Bellosta
>> http://www.datanalytics.com
>>
>>
>> 2011/4/12 pankaj borah <pankajborah2k3 at yahoo.co.in>:
>> > I have a list ( L) of 63 objects and each object has 30800 variables.
>> >
>> >>str (L)
>> >
>> > List of 63
>> >  $ objec1  : num [1:30300] 0.927 0.813 0.397 0.703 0.651 ...
>> >  $ object2  : num [1:30300] 0.636 0.447 0.738 0.648 0.62 ...
>> > .............
>> >  $ object63  : num [1:30380] 0.1123 0.2119 0.4078 0.0383 0.0641 ....
>> >
>> >
>> >
>> >
>> > I want to convert  the list L to a matrix M
>> >
>> > So it should be ---
>> >>str(M)
>> >
>> > num [1:30380, 1:63]
>> >  attr(*, "dimnames")=List of 2
>> >
>> >
>> > How do I do that ?
>> >
>> > Regards,
>> >
>> > Pankaj Barah
>> >
>> > Department of Biology,
>> > Norwegian University of Science & Technology (NTNU)
>> > Realfagbygget, N-7491 Trondheim, Norway
>> >
>> >        [[alternative HTML version deleted]]
>> >
>> >
>> > _______________________________________________
>> > Bioconductor mailing list
>> > Bioconductor at r-project.org
>> > https://stat.ethz.ch/mailman/listinfo/bioconductor
>> > Search the archives:
>> > http://news.gmane.org/gmane.science.biology.informatics.conductor
>> >
>
>
>
>
>



More information about the Bioconductor mailing list