Bubble Charts in R

In this post post, I’m going to show you how to do nice bubble charts with R. The data are available here.

Building a spatial grid with R

In this post, we are going to learn how to build a spatial grid with R. It can be sometimes very useful to use a grid composed of equal-area cells in order to aggregate the data as a precursor to data analysis and visualization. For example, we can build a grid to spatially aggregate tweets posted from the metropolitan area of Barcelona in 2012 to build a heat map and/or perform a hotspot spatial analysis as we did in this paper.

Human diffusion and city influence

I recently co-authored a paper entitled “Human diffusion and city influence” in which we propose a new method to measure global and regional influence of world cities using geolocated tweets. In this paper, we select 58 out of the most populated cities of the world and analyze their influence in terms of the average radius traveled and the area covered by Twitter users visiting each of them as a function of time. In this post, I’ll show you how to make a movie displaying the “diffusion” of Twitter users from one city to the rest of the world with R. More precisely, we are going to generate and to merge into a gif file several maps of geolocated tweets of users who have been at least once in a city (Paris for example) according to the number of days since the first passage in the city.

Parallel computing with R

I discovered the Snowfall package sometimes ago, by chance, while trying to iteratively extract the area of intersecting polygons. Despite clearing all the workspace variables at the end of each loop, the memory was increasing irremediably until R crashed. Since I was not able to solve the problem directly, I decided to circumvent it by trying to find a way to open a new “R session” (on a new core) at each iteration, execute a function (in my case it was computing the area of the intersection between polygons), and then close the session. This is exactly what the Snowfall package proposes with a lot of function able to execute parallel calculations.

Export a spatial object as KML with R

It can be useful sometimes to visualize your data using Google Earth. For example, if you want to explore the population density map of a city, you can project it on Google Earth to investigate in detail which neighbours are most populated. In this post, I’m going to show you how to export a spatial object in KML format with R.