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

Nidhi Kohli nidhik at umd.edu
Sun Mar 22 18:40:55 CET 2009

```JiHo,

Thanks for the reply, however i dont think it will help. Okay here is what i will achieve once i get this into a list format. I have another file in the following format:
0.63275433157105
0.686061949818395
0.786426681675948
0.954103894997388
0.600840965518728
0.949194842483848
0.972337634302676
0.830398896243423
0.81455702194944
0.530893135233782
0.602987287449650
0.588278376264498
0.843511423328891
0.692051859106869
0.884920709999278
0.748849621042609
0.858809254132211
0.995953047415242
0.690017589717172
0.888722610659897

I need to compute correlation between these two sets. So i'm trying to convert my other file also in the above format so that i can use the function to compute correlation

Nidhi

---- Original message ----
>Date: Sun, 22 Mar 2009 13:27:32 -0400
>From: JiHO <jo.lists at gmail.com>
>Subject: Re: [R] Converting Matrix into List - problem (urgent)
>To: Nidhi Kohli <nidhik at umd.edu>
>Cc: "R Help" <r-help at stat.math.ethz.ch>
>
>On 2009-March-22  , at 13:06 , Nidhi Kohli wrote:
>
>> Thank you so much for the quick reply. Let me explain you what I
>> want. I have a data file in the following format:
>>
>> 0.610251D+00 0.615278D+00 0.583581D+00 0.560295D+00
>> 0.501325D+00 0.639512D+00 0.701607D+00 0.544963D+00
>> 0.589746D+00 0.648588D+00 0.608216D+00 0.582599D+00
>> 0.625204D+00 0.523065D+00 0.627593D+00 0.621433D+00
>> 0.733730D+00 0.498495D+00 0.748673D+00 0.591025D+00
>> 0.578333D+00 0.564807D+00 0.652199D+00 0.579333D+00
>>
>> 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)
>> .......
>> ........
>>
>> Can you tell me how can i achieve this? I think i'm pretty close but
>> don't know how to remove the Row Name and Col. name from the
>> conFirstTwenty list (see my code)
>
>Alternatives:
>
>congeneric <- scan(textConnection("0.610251 0.615278 0.583581 0.560295
>0.501325 0.639512 0.701607 0.544963
>0.589746 0.648588 0.608216 0.582599
>0.625204 0.523065 0.627593 0.621433
>0.733730 0.498495 0.748673 0.591025
>0.578333 0.564807 0.652199 0.579333"), sep=" ")
># you would use scan with the filename in which the data is, rather
>than the textConnection. That's just for the purpose of the
>demonstration here.
>
># possible outputs
>congeneric[1:20]
>
>as.list(congeneric[1:20])
>
>for (i in 1:20) {
>	cat(congeneric[i],"\n")
>}
>
>JiHO
>---
>http://jo.irisson.free.fr/
>

```