Mapping the world with tweets (including a GIF without cats and a Shiny App).

February 16, 2015
By

(This article was first published on Rcrastinate, and kindly contributed to R-bloggers)

A few days ago, I collected 30 minutes of tweets all around the world. I used the twitteR and streamR packages for this. The nice thing about those tweets is that they have geo-information associated with them. Not all of them, of course, but more than enough.

Let’s see, what happens if we plot all the tweets at their respective position.
(this is a large PNG file, please click to enlarge)
Isn’t this awesome?! It’s a map of the world – without using any map packages or stuff like that. Only half an hour of tweets. Of course, some parts of the world are seriously underrepresented like Africa and Australia.
Where can we go from here? We have lots of information available. For example, we can use the time stamp to see the world map “emerge” over time. So, here’s a GIF also showing the running second from when I began to collect the tweets. Please note that I made larger steps at the end.
(5M gif, please click to enlarge)
There is another information associated with each tweet. It’s the language of the tweet according to Twitter’s classification algorithm. Let’s see how it looks if we assign a color to each of the TOP10 languages within these 30 minutes.
(click to enlarge)
And a high resolution version of the same plot (for zooming and stuff).
(high res version, click to enlarge)
Of course, we can have a look at different parts of the world.
Europe (click to enlarge).

The UK
(please refer to the legends in the other plots to know which color is which langauge).
North America.

South America.
Finally, the nice folks over at shinyapps.io let you host your own Shiny application. Here, you can choose one or more of the TOP10 languages and the Shiny App creates your own map.
(CODE IS COMING SOON.)

To leave a comment for the author, please follow the link and comment on their blog: Rcrastinate.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)