MaelKubli / RTwitterV2

R functions for Twitter's v2 API
MIT License
46 stars 6 forks source link

Error in data_list[[i]] when iterating in loop with user_ids #11

Closed sergiospagnuolo closed 2 years ago

sergiospagnuolo commented 2 years ago

Hello, I am trying to iterate in a list with 100 user ids using purrr. However, I get the following error:

Error in data_list[[i]] : 
attempt to select less than one element in integerOneIndex

Here is my code

tweets <- function(d) {
  RTwitterV2::get_timelines_v2(
    token = bearer,
    user_id = 'd',
    n = 100
  )
}

a <- profiles$user_id %>% purrr::map_df(tweets)
MaelKubli commented 2 years ago

Hi

I had a look at the code you submitted. From what I can tell this looks like an error which happens, when the submitted user_id does not exist. This is something which at the moment is not implemented with an error message in this function at the moment.

I will add that in some way with a small update (Version. 0.2.6.4).

Please check if the submitted id is valid. If not it is just not finding any tweets due to a faulty user_id. Otherwise I would be very happy to have a few of the id's which seem to break the function.

all the best, Maël

sergiospagnuolo commented 2 years ago

Thank you, Mael, it was indeed an error with one of the ids. We found a way around. Cheers.