[This article was first published on You Know, 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.
For a community project, I needed to research which U.S. cities were most similar to mine. The U.S. census has some wonderful data that covers 1,579 statistical areas, using the Office of Management & Budget’s definition.Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
With this data, I selected the relevant attributes and then calculated the root mean squared error of the scaled distances from the target city as a (dis)similarity metric. After sorting the results, I could identify the ten most similar cities.
But there was a catch… I was to share my findings in a presentation and raw statistics aren’t always conducive to making engaging slide shows. Displaying two dimensions is straightforward, maybe even three or four are doable. My analysis had forty-plus dimensions. My approach was to think of each attribute as a point in a DNA strand. When you are finished, each little twist and turn represents another data point. Up or down ticks don’t matter, they just show the shape of the city in data-vision. FYI, all images were created using the ggplot2 package in R.
Start with a graph of each (scaled) point plotted. |
Next, remove the grid lines. |
Connect the dots. |
Display all of the other cities’ strands. |
Subset to the ten cities most similar to yours. |
Visualized as a layered animation |
To leave a comment for the author, please follow the link and comment on their blog: You Know.
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.