Re: [R] To transform an adjacency matrix

2013-11-20 Thread Arnaud Michel
Thank you also for your help Michel Le 20/11/2013 19:04, Dennis Murphy a écrit : Hi: which(m == 1L, arr.ind = TRUE) Dennis On Wed, Nov 20, 2013 at 2:28 AM, Arnaud Michel wrote: Hi I have the following problem I would like to build, from a matrix filled with 0 and with 1, a matrix or a data.f

Re: [R] To transform an adjacency matrix

2013-11-20 Thread David Carlson
November 20, 2013 4:29 AM To: R help Subject: [R] To transform an adjacency matrix Hi I have the following problem I would like to build, from a matrix filled with 0 and with 1, a matrix or a data.frame which contains, in every line, the number of the line and the number of the column of the m

Re: [R] To transform an adjacency matrix

2013-11-20 Thread Arnaud Michel
Thank you Pascal Its fine Michel Le 20/11/2013 11:55, Pascal Oettli a écrit : Hello, One approach is: m <- structure(c(0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0), .Dim = c(5L, 5L)) out <- which(m==1, arr.ind=TRUE) out[order(out[,1]),] Regards, Pascal On 20 Nove

Re: [R] To transform an adjacency matrix

2013-11-20 Thread Pascal Oettli
Hello, One approach is: m <- structure(c(0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0), .Dim = c(5L, 5L)) out <- which(m==1, arr.ind=TRUE) out[order(out[,1]),] Regards, Pascal On 20 November 2013 19:28, Arnaud Michel wrote: > Hi > I have the following problem > I w

[R] To transform an adjacency matrix

2013-11-20 Thread Arnaud Michel
Hi I have the following problem I would like to build, from a matrix filled with 0 and with 1, a matrix or a data.frame which contains, in every line, the number of the line and the number of the column of the matrix for which the value is equal to 1. Exemple : dput(m) structure(c(0, 0, 0, 1, 0