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

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to