Hello everybody,
today we´re going to put our followers and people we follow on a map and visualize them this way.
This is very easy because of Jeff Leek who wrote a nice little R script we can use today.
But before the fun begins we have to go through the oAuth process as described in this post.
Ok now we can go on:
We have to define the script by Jeff Leek as our source. We do it with:
1 |
source(“http://biostat.jhsph.edu/~jleek/code/twitterMap.R”) |
Map Twitter Followers with R
In this script we can find the function twitterMap.
1 |
twitterMap <- function(userName,userLocation=NULL,fileName=“twitterMap.pdf”,nMax = 1000,plotType=c(“followers”,“both”,“following”)) |
You can see this function has different parameters.
“userName” is the user whose follower and people he´s following we want to visualize.
“userLocation” has to be defined when this user did not specify his location in his twitter profile.
“fileName” is the name of the file the generated map is saved to and “nMax” is the limit of how many followers are used. So if i have 2000 followers, now just 1000 are visualized on the map.
Last but not least we can define the “plotType” to “followers”, “both” and “following”; so if we want to see the follower, the people i´m following or both on the map.
And that`s it.
I used the following parameters to create the map of the followers of @socialmedia2day
1 |
twitterMap("socialmedia2day", fileName="Map_socialmedia2day.pdf", nMax=3000) |