[R] Converting Matrix into List - problem (urgent)

JiHO jo.lists at gmail.com
Sun Mar 22 18:20:35 CET 2009


On 2009-March-22  , at 13:06 , Nidhi Kohli wrote:

> I'm reading this file into a variable named congeneric (see my code)  
> and now trying to pick up first 20 values and need these 20 values  
> in a list format like
>
> 0.610251D+00 (row 1, col 1)
> 0.615278D+00 (row 1, col 2)
> 0.583581D+00 (row 1, col 3)
> .......
> ........


Basically you want a list in which each element as only one value in  
it. And those elements are the first twenty of the previous matrix,  
reading by line, then column.

I am not sure about:

> I want to remove the Column name and Row name from the above output.  
> Any help on this will be greatly appreciated (I'm open to any other  
> alternative way to convert Matrix into List also)

I don't see any column or row name in

> [[1]]
> [1] "0.520404D+00"
> [[2]]
> [1] "0.601942D+00"
> [[3]]
> [1] "0.603340D+00"
> [[4]]
> [1] "0.655582D+00"
> [[5]]
> [1] "0.490995D+00"
> .........
> ..........
> ..........
> ...........
> [[20]]
> [1] "0.627368D+00"

That's just a the way a list is printed. If you just want a clean  
visual output, then use cat in a for loop.

So I guess my question is what are you trying to achieve with that?  
What do you need the list for? It would help to know (a bit) of the  
general context to help you.

JiHO
---
http://jo.irisson.free.fr/




More information about the R-help mailing list