This page shows Multidimensional Scaling (MDS) with R. It demonstrates with an example of automatic layout of Australian cities based on distances between them. The layout obtained with MDS is very close to their locations on a map. At first, the data of distances between 8 city in Australia are loaded from http://rosetta.reltech.org/TC/v15/Mapping/data/dist-Aus.csv.
Alternatively, we can download the file first and then read it into R from local drive.
Then we remove the frist column, acronyms of cities, and set them to row names.
After that, we run Multidimensional Scaling (MDS) with function
Then we visualise the result, which shows the positions of cities are very close to their relative locations on a map.
By flipping both x- and y-axis, Darwin and Brisbane are moved to the top (north), which makes it easier to compare with a map.
MDS is also implemented in the
|
Examples >