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,
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 michel.arn...@cirad.fr wrote:
Hi
I have the
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
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 matrix for which the value
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 michel.arn...@cirad.fr wrote:
Hi
I have the following problem
I would like to build, from a matrix filled with 0 and with
5 matches
Mail list logo