Skip to content

Instantly share code, notes, and snippets.

@IanHopkinson
Created April 5, 2013 10:44
Show Gist options
  • Save IanHopkinson/5318354 to your computer and use it in GitHub Desktop.
Save IanHopkinson/5318354 to your computer and use it in GitHub Desktop.
A gist in R showing how to plot twitter data from ScraperWiki as a smoothScatter plot
# Some experiments in R to handle twitter profile data
# Ian Hopkinson 2013-03-28
# First we get the data in JSON format and then convert to a data.frame
library(rjson)
TwitterRecordsFile = 'http://box.scraperwiki.com/bdaw7xa/a6e8e71d96b2449/sql?q=select+*+from+twitter_followers'
TwitterRecords = fromJSON(file=TwitterRecordsFile, method='C')
Twitterdf=data.frame(t(sapply(TwitterRecords,c)))
# smoothScatter is in base R
smoothScatter(Twitterdf$followers_count,Twitterdf$following_count,xlim=c(0,5000),ylim=c(0,5000),main="Followers vs following count for a subset of twitter users")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment