Skip to content

Instantly share code, notes, and snippets.

@myuhe
Created February 5, 2010 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myuhe/295829 to your computer and use it in GitHub Desktop.
Save myuhe/295829 to your computer and use it in GitHub Desktop.
library(twitteR)
init <- initSession("username", "password")
followlist <- userFriends("username",init)
follow <- sapply(1:length(followlist), function(x) followlist[[x]] @ friendsCount)
follower <- sapply(1:length(followlist), function(x) followlist[[x]] @ followersCount)
status <- sapply(1:length(followlist), function(x) followlist[[x]] @ statusesCount)
name <- sapply(1:length(followlist), function(x) followlist[[x]] @ screenName)
mat <- cbind(follow, follower, status)
rownames(mat) <- name
mat <- mat[complete.cases(mat),]
hc <- hclust(dist(mat))
plot(hc)
library(rgl)
open3d()
plot3d(follow, follower, status)
dat <- data.frame(name,follow,follower,status)
library(tree)
library(maptree)
res.tree <- tree(status~follower+follow,dat)
plot(res.tree)
summary(res.tree)
draw.tree(res.tree)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment