[R] Creating adjacency matrix from a data frame
Thomas Jensen
thomas.jensen at eup.gess.ethz.ch
Sun Sep 6 22:12:38 CEST 2009
Dear R-list,
Sorry for spamming the list, but I am just learning how to manipulate
data in R, so if this is a trivial question I am sorry.
I have the following data which list the distance between capitals:
ida idb kmdist
7108 "UK" "BEL" " 313"
7110 "UK" "FRN" " 365"
7116 "UK" "POR" "1618"
I would like to convert this into an a valued adjacency matrix that
looks like this:
BEL FRN POR
UK 313 365 1618
The full data set has all possible pairings between countries, so the
end goal should be a symmetric adjacency matrix.
Thank you,
Thomas Jensen
More information about the R-help
mailing list