- Explore location-based datasets from SNAP (using loc-gowalla in this post)
- Learn how to draw maps using R (from StackOverflow and Google haha)
Download the dataset, including the social network and check-in logs. Save the introduction of this dataset.
I put all codes at the end of this post.
I first visualize check-in logs in a map (see ref. ). Because there are too many check-in logs, I only randomly sample some to them to visualize. The output is as follows. We can see that most logs are check-ins to the US or countries in Europe.
Mapping country codes to check-ins is done by the method in . For simplicity (because I am lazy), I only keep the country name of each check-in. Countries with most check-ins are listed as follows.
Check-ins have been labeled by their corresponding country/area in the previous step. I visualize the total number of check-ins of each country. The results are as follows.
Because more than half of the check-ins are map to locations in US. We visualize the number of check-ins to each state of the US. Only lower 48 states and Washington, D.C. are shown in the figure. (The “map_data(‘state’)” only contains lower 48 states + D.C.) The results are as follows.
In fact, top-5 states with most check-ins are as follows.
Codes are as follows. I hope they are self explanatory.
- R Beginners – Plotting Locations on to a World Map https://www.r-bloggers.com/r-beginners-plotting-locations-on-to-a-world-map/
- Assign Country Code to Tweets Based on GPS Coordinates https://zacharyst.com/2016/02/12/when-twitter-doesnt-give-a-country-code/
- Administrative regions map of a country with ggmap and ggplot2 (Visualizing unemployment rate) http://stackoverflow.com/questions/17723822/administrative-regions-map-of-a-country-with-ggmap-and-ggplot2