Here is the bar plot of the result
As expected news sources dominate the list. Among individuals "Michael Hyatt" and "Jurgen Appelo" are most active.
If you are interested in 'R', here is the code to extract this report:
## Prerequisite: Install twitteR package 'install.packages(twitteR) ## load twitteR package library(twitteR) ##get handle to a twitteR user object (in this case for user d_lalit tuser <- getUser('d_lalit') ##get list of friends of d_lalit tfriends <- userFriends(tuser) ##create an array to store the name and number of status messages for each friend friendsCount <- length(tfriends) friendsName <- character(friendsCount) friendsMsgCount <- numeric(friendsCount) for (i in 1:friendsCount) { friendsName[i] <- tfriends[[i]]$screenName friendsMsgCount[i] <- as.numeric(tfriends[[i]]$statusesCount) } ## prepare a sortedlist and extract top 10 values from the list sortedlist <- sort(friendsMsgCount, index.return = TRUE, decreasing=TRUE) top10friendsName <- character(10) top10friendsMsgCount <- numeric(10) for (i in 1:10) { top10friendsName[i] <- friendsName[sortedlist$ix[[i]]] ## index is stored under ix top10friendsMsgCount[i] <- as.numeric(sortedlist$x[[i]]) } ## plot the chart barplot(top10friendsMsgCount, width = 0.25, names.arg = top10friendsName, horiz=FALSE, main="Twitter friends by activity count", ylab="Number of status messages", xlab="twitter friends", space=0.2, density=50, angle=45, cex.names=0.7)
Update: 11/29/2011
In the latest version of twitteR package, the method userFriends() has been deprecated. You may replace line#9 in the above code as with the code given below:
tfriends <- tuser$getFriends()
No comments:
Post a Comment