R(フォロワー> 100000)を使ってユーザーのTwitterフォロワーのプロフィールを探したいと思います。 twitteRは素晴らしいパッケージですが、レート制限を超えないようにスリープルーチンを実装する必要があるため、高いレベルのフォロワーを扱うときに問題があります。私はここでは相対的に初心者であり、フォロワーIDオブジェクトをどのようにループしてフォロワーIDを100のバッチで入力するのか疑問に思っています(これはTwitter APIが一度に処理できる最大のものです)。ルックアップTwitterのフォロワーR
編集:コードは、私が最初に私はTwitterのパッケージを使用していないことを伝えることから始めましょう (ツイッター) ライブラリ(plyr) maxTwitterIds = 100 = 500#秒 スリープ時間
user<-getUser("[username]")
followers<-zz$getFollowerIDs()
ids_matrix = matrix(zz, nrow = maxTwitterIds, ncol = length(zz)/maxTwitterIds)
followers<-zz$getFollowerIDs()
#note: for smaller lists of followers it is possible to use the command "lookupUsers(zz) at this point
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)
})
私は、http://cran.r-project.org/web/packages/twitteR/twitteR.pdfの6ページで、あなたは良い情報を見つけることができると思います。 – aatrujillob
ええ、問題は、フォロワーの大きなリストを扱うときに、速度制限をすばやく超えているため、IDブロックを100のバッチに分割してSys.sleepの後にそれぞれ実行する方法を探しています。 –