Skip to content
Prev 319349 / 398506 Next

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 Barradas

Em 12-03-2013 21:45, avinash sahu escreveu: