Skip to content
This repository has been archived by the owner on Nov 10, 2024. It is now read-only.

search_tweets() Error in vector("list", ntimes) : invalid 'length' argument #390

Closed
mjfrigaard opened this issue Feb 4, 2020 · 4 comments

Comments

@mjfrigaard
Copy link

mjfrigaard commented Feb 4, 2020

Problem

I have been trying to use rtweet this morning, but run into issues with the search_tweet() function.

First I create a list of terms (accounts):

twitter_app_searches <- paste("@delta", "@aureliusvalue", 
                        "@viceroyresearch", "@citronresearch", 
                        "@muddywatersresearch", "@alderlaneeggs", 
                        "@contrarianshort", "@capitolistpig", 
                        "@hedgeye", "$GOGO", "$HIIQ", sep = " OR ")
twitter_app_searches

then I use the function...

## search for 1000 tweets using the vector created above
StockSearches <- rtweet::search_tweets(q = twitter_app_searches, 
                                     # keep trying to get more tweets
                                     retryonratelimit = TRUE, 
                                     parse = TRUE,
                                     n = 1000, 
                                     include_rts = TRUE)
StockSearches

Expected behavior

This should result in a data frame like the vignette shows, but instead I get this error:

Error in vector("list", ntimes) : invalid 'length' argument

Reproduce the problem

## insert code here
devtools::install_github("mkearney/rtweet")
library(rtweet)
library(httr)
library(httpuv)
library(tidyverse)
library(visdat)
library(inspectdf)
library(skimr)

twitter_app_searches <- paste("@delta", "@aureliusvalue", 
                        "@viceroyresearch", "@citronresearch", 
                        "@muddywatersresearch", "@alderlaneeggs", 
                        "@contrarianshort", "@capitolistpig", 
                        "@hedgeye", "$GOGO", "$HIIQ", sep = " OR ")
twitter_app_searches

## search for 1000 tweets using the vector created above
StockSearches <- rtweet::search_tweets(q = twitter_app_searches, 
                                     # keep trying to get more tweets
                                     retryonratelimit = TRUE, 
                                     parse = TRUE,
                                     n = 1000, 
                                     include_rts = TRUE)
# > Error in vector("list", ntimes) : invalid 'length' argument

rtweet version

## copy/paste output
packageVersion("rtweet")
[1] ‘0.7.0

Session info

## copy/paste output
sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.3

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] inspectdf_0.0.7   visdat_0.5.3      httpuv_1.5.2      httr_1.4.1       
 [5] rtweet_0.7.0      hrbrthemes_0.6.0  mosaic_1.5.0      Matrix_1.2-18    
 [9] mosaicData_0.17.0 ggformula_0.9.2   ggstance_0.3.3    lattice_0.20-38  
[13] skimr_2.1         janitor_1.2.1     forcats_0.4.0     stringr_1.4.0    
[17] dplyr_0.8.4       purrr_0.3.3       readr_1.3.1       tidyr_1.0.2      
[21] tibble_2.1.3      ggplot2_3.2.1     tidyverse_1.3.0  

loaded via a namespace (and not attached):
 [1] colorspace_1.4-1  ellipsis_0.3.0    rsconnect_0.8.16  leaflet_2.0.3    
 [5] rprojroot_1.3-2   base64enc_0.1-3   ggdendro_0.1-20   fs_1.3.1         
 [9] rstudioapi_0.10   farver_2.0.3      remotes_2.1.0     ggrepel_0.8.1    
[13] ggfittext_0.8.1   fansi_0.4.1       lubridate_1.7.4   xml2_1.2.2       
[17] splines_3.6.1     extrafont_0.17    knitr_1.27        pkgload_1.0.2    
[21] jsonlite_1.6.1    packrat_0.5.0     broom_0.5.4       Rttf2pt1_1.3.8   
[25] dbplyr_1.4.2      shiny_1.4.0       compiler_3.6.1    backports_1.1.5  
[29] assertthat_0.2.1  fastmap_1.0.1     lazyeval_0.2.2    cli_2.0.1        
[33] later_1.0.0       htmltools_0.4.0   prettyunits_1.1.1 tools_3.6.1      
[37] gtable_0.3.0      glue_1.3.1        Rcpp_1.0.3        cellranger_1.1.0 
[41] vctrs_0.2.2       nlme_3.1-143      extrafontdb_1.0   crosstalk_1.0.0  
[45] xfun_0.12         ps_1.3.0          testthat_2.3.1    rvest_0.3.5      
[49] mime_0.8          lifecycle_0.1.0   mosaicCore_0.6.0  devtools_2.2.1   
[53] MASS_7.3-51.5     scales_1.1.0      hms_0.5.3         promises_1.1.0   
[57] yaml_2.2.1        curl_4.3          memoise_1.1.0     gridExtra_2.3    
[61] gdtools_0.2.1     stringi_1.4.5     desc_1.2.0        pkgbuild_1.0.6   
[65] repr_1.1.0        rlang_0.4.4       pkgconfig_2.0.3   systemfonts_0.1.1
[69] evaluate_0.14     labeling_0.3      htmlwidgets_1.5.1 tidyselect_1.0.0 
[73] processx_3.4.1    magrittr_1.5      R6_2.4.1          generics_0.0.2   
[77] DBI_1.1.0         pillar_1.4.3      haven_2.2.0       withr_2.1.2      
[81] modelr_0.1.5      crayon_1.3.4      utf8_1.1.4        rmarkdown_2.1    
[85] progress_1.2.2    usethis_1.5.1     grid_3.6.1        readxl_1.3.1     
[89] callr_3.4.1       reprex_0.3.0      digest_0.6.23     xtable_1.8-4     
[93] openssl_1.4.1     munsell_0.5.0     askpass_1.1       sessioninfo_1.1.1

Token

## copy/paste output
rtweet::get_token()
<Token>
<oauth_endpoint>
 request:   https://api.twitter.com/oauth/request_token
 authorize: https://api.twitter.com/oauth/authenticate
 access:    https://api.twitter.com/oauth/access_token
<oauth_app> hacknews2014
  key:    XXXXXXXXXXXXXX
  secret: <hidden>
<credentials> oauth_token, oauth_token_secret
---
@danielspottiswood
Copy link

Having the same problem

@danielspottiswood
Copy link

Reinstalling/updating httr fixed this issue for me.

@danielspottiswood
Copy link

Nevermind. Issue resurfaced.

@llrs llrs mentioned this issue Feb 15, 2021
@llrs
Copy link
Collaborator

llrs commented Feb 17, 2021

Works for me, perhaps was a problem with API rate limits?

@llrs llrs closed this as completed Feb 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants