Hi everyone.

This is my first ever ask for help, having searched archives and the package help, CRAN, and stackoverflow, and having spent 3 days on this.

I am using a modified version of Pablo Barbera's code (https://github.com/pablobarbera/workshop/blob/master/code/02_analysis_twitter_nyu.R) to graph the Twitter follower network for an individual and those they follow. The rate limit is 15 calls/15mins for friends/ids. However, my code is constantly exceeding that. I have published my code here: https://github.com/BuaCh41Ll/Twitter_network/blob/master/map_twitter_user_network.R

I would be grateful for any hints on how to resolve the rate limit issue. I suspect that the issue is within the while loop (copied below)

while (length(ir_pol.users) > length(follow.list)) {
user <- ir_pol.users[ir_pol.users %in% names(follow.list) == FALSE], 1)
user <- getUser(user)
user.n <- user$screenName
following <- user$getFriends()
friends <- as.character(lapply(following, function(x) x$getScreenName()))
follow.list[[user.n]] <- friends
descriptions <- as.character(lapply(following, function(x) x$getDescription()))
ir_pol <- extract.irishpolitics(descriptions)
new.users <- lapply(following[ir_pol], function(x) x$getScreenName())
new.users <- as.character(new.users)
ir_pol.users <- unique(c(ir_pol.users, new.users))
limit <- getCurRateLimitInfo()[47, 3]
while (limit == "0") {
Sys.sleep(901)
limit <- getCurRateLimitInfo()[47, 3]
}
print(ir_pol.users)
} Fingers crossed that my first post is appropriate to the group and my apologies if I have erred in its construction. Niall

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to