[R] Neighbour List to Matrix

jim holtman
Fri, 17 Feb 2012 18:12:55 -0000

You might want to post a better example of what your data looks like.
In the email, it is hard to tell how to split the data into rows that
can be read with three fields since it looks like the data is composed
of pairs of numbers.

On Fri, Feb 17, 2012 at 7:42 AM, A J <anxusgo at hotmail.com>
wrote:
>
> Hi everybody!I'm a new user of R. I've been having a look to
sotored mails in list, but I've been not able to find one suiting to my
need. The issue is I have a neighbour list in a TXT file, just as lists
generated by social network softwares (f.i. Pajek), where you get Field1,
Field2, Value. In my case, list follow the next way:ID1 ?IDP2 ? ?SUMVAL1 56 ? ?
?0.0659358951 ? ?900 ? ? 0.0441101851 ? ?1409 ? ?0.1963141973 ? ?4 ? ? ?
0.0713203883 ? ?83 ? ? ?0.0162695643 ? ?529 ? ? 0.0113592393 ? ?883 ? ?
0.0122425333 ? ?1242 ? ?0.0165589244 ? ?3 ? ? ? 0.0043070244 ? ?7 ? ? ?
0.0046998214 ? ?16 ? ? ?0.0047351125 ? ?7 ? ? ? 0.0103249265 ? ?16 ? ?
?0.0112505045 ? ?498 ? ? 0.0097098585 ? ?502 ? ? 0.0047757495 ? ?508 ? ?
0.031411560
> The question is, how can I convert this list into a matrix? I think is good
to know that list contain more than 600000 rows with around 14000 nodes
(participants). If it's possible I would like to know all necessary stetps
to do this. This is: load the TXT file, create the matrix through data contained
in it, and finally to export to CSV or TXT file. Any idea or suggestion will be
wellcome!Thank you very much in advance.AJ
>
> ? ? ? ?[[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.



--
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.