I would like to see user profiles of Twitter followers using R (followers> 100000). Although twitteR is a great package, it has problems working with high levels of followers, since it is necessary to implement a sleep procedure to avoid exceeding speed limits. I'm a relative newbie here and wondered how you can loop into the repeater id object by entering follower IDs in batches of 100 (since this is the maximum Twitter API can be processed at the same time)?
Edit: added (Twitter) library code (plyr) maxTwitterIds = 100 sleeptime = 500 # sec
user<-getUser("[username]")
followers<-zz$getFollowerIDs()
ids_matrix = matrix(zz, nrow = maxTwitterIds, ncol = length(zz) / maxTwitterIds)
followers<-zz$getFollowerIDs()
foll<-getTwitterInfoForListIds = function(id_list) {
return(lapply(id_list,
names <- sapply(foll,name)
sn<sapply(foll,screenName)
id<-sapply(foll,id)
verified<-sapply(foll,erified)
created<-sapply(foll,created)
statuses<-sapply(foll,statusesCount)
follower<-sapply(foll,followersCount)
friends<-sapply(foll,friendsCount)
favorites<-sapply(foll,favoritesCount)
location<-sapply(foll,location)
url<-sapply(foll,url)
description<-sapply(foll,description)
last_status<-sapply(foll,lastStatus)))
}
alldata = alply(, 2, function(id_set) {
info = getTwitterInfoForListIds(id_set)
Sys.sleep(sleeptime)
return(info)
})
source
share