PM
Subject: Re: [R] big edge list to adjacency matrix
Hello,
The following is a bit convoluted but will do it.
dat <- read.table(text = "
a1 b1 1
a2 b2 2
a3 b3 3
a1 b1 4
a3 b1 5
")
xtabs(V3 ~ V1 + V2, data = aggregate(V3 ~ V1 + V2, data = dat, FUN = max))
Hope this helps,
Rui Bar
Hello,
The following is a bit convoluted but will do it.
dat <- read.table(text = "
a1 b1 1
a2 b2 2
a3 b3 3
a1 b1 4
a3 b1 5
")
xtabs(V3 ~ V1 + V2, data = aggregate(V3 ~ V1 + V2, data = dat, FUN = max))
Hope this helps,
Rui Barradas
Em 12-03-2013 21:45, avinash sahu escreveu:
I have huge l
I have huge list of edges with weights.
a1 b1 w1
a2 b2 w2
a3 b3 w3
a1 b1 w4
a3 b1 w5
I have to convert it into 2 dim matrix
b1b2 b3
a1 max(w1,w4) 0 0
a20w2 0
a3w5 0 w3
if edges repeated take the maxim
3 matches
Mail list logo