Site icon R-bloggers

Europe Data set:> eurodist                 Athens Barcelona…

[This article was first published on Human Mathematics, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.


Europe

Data set:
> eurodist                 Athens Barcelona Brussels Calais Cherbourg Cologne Copenhagen Barcelona         3313                                                       Brussels          2963      1318                                             Calais            3175      1326      204                                    Cherbourg         3339      1294      583    460                             Cologne           2762      1498      206    409       785                   Copenhagen        3276      2218      966   1136      1545     760           Geneva            2610       803      677    747       853    1662       1418 Gibraltar         4485      1172     2256   2224      2047    2436       3196 Hamburg           2977      2018      597    714      1115     460        460 Hook of Holland   3030      1490      172    330       731     269        269 Lisbon            4532      1305     2084   2052      1827    2290       2971 Lyons             2753       645      690    739       789     714       1458 Madrid            3949       636     1558   1550      1347    1764       2498 Marseilles        2865       521     1011   1059      1101    1035       1778 Milan             2282      1014      925   1077      1209     911       1537 Munich            2179      1365      747    977      1160     583       1104 Paris             3000      1033      285    280       340     465       1176 Rome               817      1460     1511   1662      1794    1497       2050 Stockholm         3927      2868     1616   1786      2196    1403        650 Vienna            1991      1802     1175   1381      1588     937       1455                 Geneva Gibraltar Hamburg Hook of Holland Lisbon Lyons Madrid Barcelona                                                                   Brussels                                                                    Calais                                                                      Cherbourg                                                                   Cologne                                                                     Copenhagen                                                                  Geneva                                                                      Gibraltar         1975                                                      Hamburg           1118      2897                                            Hook of Holland    895      2428     550                                    Lisbon            1936       676    2671            2280                    Lyons              158      1817    1159             863   1178             Madrid            1439       698    2198            1730    668  1281       Marseilles         425      1693    1479            1183   1762   320   1157 Milan              328      2185    1238            1098   2250   328   1724 Munich             591      2565     805             851   2507   724   2010 Paris              513      1971     877             457   1799   471   1273 Rome               995      2631    1751            1683   2700  1048   2097 Stockholm         2068      3886     949            1500   3231  2108   3188 Vienna            1019      2974    1155            1205   2937  1157   2409                 Marseilles Milan Munich Paris Rome Stockholm Barcelona                                                   Brussels                                                    Calais                                                      Cherbourg                                                   Cologne                                                     Copenhagen                                                  Geneva                                                      Gibraltar                                                   Hamburg                                                     Hook of Holland                                             Lisbon                                                      Lyons                                                       Madrid                                                      Marseilles                                                  Milan                  618                                  Munich                1109   331                            Paris                  792   856    821                     Rome                  1011   586    946  1476               Stockholm             2428  2187   1754  1827 2707          Vienna                1363   898    428  1249 1209      2105

Multi-dimensional scaling of the distances:

> cmdscale(eurodist)                         [,1]        [,2] Athens           2290.274680  1798.80293 Barcelona        -825.382790   546.81148 Brussels           59.183341  -367.08135 Calais            -82.845973  -429.91466 Cherbourg        -352.499435  -290.90843 Cologne           293.689633  -405.31194 Copenhagen        681.931545 -1108.64478 Geneva             -9.423364   240.40600 Gibraltar       -2048.449113   642.45854 Hamburg           561.108970  -773.36929 Hook of Holland   164.921799  -549.36704 Lisbon          -1935.040811    49.12514 Lyons            -226.423236   187.08779 Madrid          -1423.353697   305.87513 Marseilles       -299.498710   388.80726 Milan             260.878046   416.67381 Munich            587.675679    81.18224 Paris            -156.836257  -211.13911 Rome              709.413282  1109.36665 Stockholm         839.445911 -1836.79055 Vienna            911.230500   205.93020

Plot

     require(stats)      loc <- cmdscale(eurodist)      rx <- range(x <- loc[,1])      ry <- range(y <- -loc[,2])      plot(x, y, type="n", asp=1, xlab="", ylab="")      abline(h = pretty(rx, 10), v = pretty(ry, 10), col = "light gray")      text(x, y, labels(eurodist), cex=0.8)

To leave a comment for the author, please follow the link and comment on their blog: Human Mathematics.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.