Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
andrescaso
Resolver I
Resolver I

Conéctese a twitter api a través de R script

Hola

Tengo un problema con mi guión R,

biblioteca("ROAuth");
biblioteca("rtweet");
biblioteca (dplyr);

consumer_key <- "xxx"
consumer_secret <-"xxx"
access_token <-"319367740-xxx"
access_secret <-"xxx"

token <- create_token(
app á "xx",
consumer_key consumer_key,
consumer_secret consumer_secret,
access_token access_token,
access_secret access_secret)
chs_tweets <- get_timeline(usuario á "ClubHipico_Stgo", n á 100000, análisis , VERDADERO, comprobar , TRUE, include_rts , FALSO)
chs_flw <- get_followers("ClubHipico_Stgo", n á "all")
chs_flw_data <- lookup_users(chs_flw$user_id)
hch_tweets <- get_timeline(usuario á "hipodromo_chile", n á 100000, análisis , VERDADERO, comprobar , TRUE, include_rts , FALSO)
hch_flw <- get_followers("hipodromo_chile", n á "todo")

hch_flw_data <- lookup_users(hch_flw$user_id)

El guión funciona bien en R por cierto

después de varios pruebas, creo que este es el problema:
si utilizo la función get_followers sólo una vez, el script funciona bien, por ejemplo, utilizar el script sólo con el usuario ClubHipico_Stgo, la tabla de chs_flw obtener todos los usuarios,
pero si ejecuto el script y pongo dos veces la función get_followers, power bi me muestran este error:
Error en if (x) - : argumento tiene longitud cero
Llamadas: lookup_users ... lookup_users_ -> .user_lookup -> .ids_type -> .id_type
Ejecución de la ejecución

Debido a que las tablas de 2 seguidores (chs_flw, hch_flw) obtienen 0 seguidores

Por favor, ayúdame

saludos

1 ACCEPTED SOLUTION

Gracias yingyinr

Encontré una solución similar en esta página, el truco es pasar al argumento USER en una lista y ejecutar el código con una instrucción for

https://github.com/ropensci/rtweet/issues/238

saludos

View solution in original post

2 REPLIES 2
v-yiruan-msft
Community Support
Community Support

Hola @andrescaso ,

Revise la solución en el siguiente hilo, esperemos que pueda ayudarle.

R - argumento es de longitud cero en if instrucción

Saludos

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Gracias yingyinr

Encontré una solución similar en esta página, el truco es pasar al argumento USER en una lista y ejecutar el código con una instrucción for

https://github.com/ropensci/rtweet/issues/238

saludos

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.