Skip to content

Instantly share code, notes, and snippets.

@astatham
Created August 30, 2010 05:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astatham/557049 to your computer and use it in GitHub Desktop.
Save astatham/557049 to your computer and use it in GitHub Desktop.
#!/usr/local/bin/Rscript
library(twitteR)
library(imguR)
sess <- initSession("clark_lab_linux", "password")
rstats <- searchTwitter("#rstats", sess, n=1000)
#filter out junk
rstats <- rstats[sapply(sapply(rstats, screenName), length)>0]
#make graph
posters <- sort(table(sapply(rstats, screenName)), decreasing=TRUE)
imguR()
par(mai=c(1.5, 0.82, 0.82, 0.4))
barplot(posters[1:20], border=NA, las=2, main=paste("Top 20 #rstats tweeters since", created(rstats[[length(rstats)]])), ylab="Number of twats")
abline(h=0)
graph_url <- dev.off()
tweet(paste("Top 20 rstats tweeters automated graph!", graph_url), sess)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment