You sure all heard of Foursquare. It has more than 45 million users but it´s potential is not recognized by much people. So today I want to show you how easy it is to get your check-in history and visualize it with rCharts and a leaflet map.

This call returns your whole venue history. You might see the v argument at the end. This is actually the version of the Foursquare API you want to use. Foursquare uses the date for this. So it actually adds the current date.

In the next step we process the JSON object even further and create a dataframe where we can save all the important information we need.

We will calculate the mean longitude and latitude values of our venue history to set the initial view of our map. Because it wouldn´t make sense if most of your check-ins are in Germany but the initial view of the map shows the USA.

In the next step we will add a marker for every venue in the dataframe. We also create a popup for every marker which shows additional information.

for (i in 1:no_venues){
#Get the name and the number of check-ins of the current venue
name <- df$venue_name[i]
checkins <- df$venue_checkinsCount[i]
#Add the marker to the map but just add a website link if we have a URL for the venue
#if URL is available
if(is.na(df$url[i]))
{ map$marker(c(df$venue_lat[i], df$venue_lng[i]), bindPopup = paste(name,' <br> Checkins: ',checkins,sep=""))
}
else
{
map$marker(c(df$venue_lat[i], df$venue_lng[i]), bindPopup = paste(name,' <br> Checkins: ',checkins,'<br> <a href="',df$url[i],'" target="_blank">Website</a> ',sep=""))
}
}

And that´s it! Congratulations for creating your first foursquare check-ins map! You can now open it or save it by tipping in