Skip to content
Prev 267395 / 398502 Next

Data frame to matrix - revisited

Hi,
I've tried to look through all the previous related Threads/posts but can't find a solution to what's probably a simple question.
?
I have a data frame comprised of three columns e.g.:
?
ID1?ID2?Value
a?b?1
b?d?1
c?a?2
c?e?1
d?a?1
e?d?2
?
I'd like to convert the data to a matrix i.e.:
?
?a b c d e
a n/a 1 2 1 n/a
b 1 n/a n/a 1 n/a?
c 2 n/a n/a n/a 1
d 1 1 n/a n/a 2
e n/a n/a 1 2 n/a
?
Any help is much appreciated,
?
Jagz