Problem
I'm using get_timeline() and then network_data() in a for loop to request user data and then pull out the network data. The code looks like this (in the example, I include a user_id that produces the error):
for (i in list_userids) {
twt <- rtweet::get_timeline(
user = 1016593091480948736,
n = 500,
retryonratelimit = TRUE
)
#extracting network data
net <- network_data(twt, e = "all")
#row binding net data
net_all <- rbind(net_all, net)
}
The error occurs when running network_data() :
Error in data.frame(from = um$id_str, to = ur$id_str, type = "retweet") :
arguments imply differing number of rows: 497, 499, 1
Expected behavior
The for loop works, but the row error occurs in 1 out of every 5 or so loops. The list_userids contains around 800 ids, and the error occurred around 160 times.
The error doesn't occur at the same row number. For example, when running the same get_timeline() and network_data() loop using user id 231751795, the resulting error gives: arguments imply differing number of rows: 334, 335, 1
rtweet version
I am using rtweet version: 1.0.2
R version: 4.2.1
R studio: 2022.07.1 Build 554
Please let me know if you need more information.