r - 在 for 循环中 TwitteR searchTwitter() 调用不起作用
问题描述
我目前正在尝试对 NBA 中的 21 名球员中的每一位进行 searchTwitter() 调用,以获取有关他们的 100 条最新推文。然而,奇怪的是,该调用在我的 lastMVPs 循环(这是一个名称列表)中工作,但在 10 次循环后停止,这将只有 1,000 个 API 调用。现在该调用仅在 for 循环之外有效。有谁知道这是为什么?
例如 - 这有效:
searchTwitter("Lebron James", n = 2, lang = 'en')
但这不会:
for (name in lastMVPs) {
newitem = searchTwitter(name, n = 100, lang = 'en')
df = twListToDF(newitem)
name = df$text
tweetMatrix = cbind(tweetMatrix, name)
}
我得到了错误
Error in twListToDF(newitem) : Empty list passed to twListToDF
In addition: Warning message:
In doRppAPICall("search/tweets", n, params = params, retryOnRateLimit = retryOnRateLimit, :
100 tweets were requested but the API can only return 0
这对我来说没有意义,因为当 API 已经在循环外为我的调用工作时,它如何才能最大化?
解决方案
推荐阅读
- firebase - 如何将 Firebase 数据导入欧盟的 Bigquery 数据集?
- google-cloud-platform - 有什么方法可以为 Google Cloud 的网络流量设置配额?
- sql-server - SQL DB Stacking 中的单个数据库开始
- android - 什么是 android-sdk 和 android-auth libs 开源许可证?
- c# - 在 Eyeshot 11 中选择 Solid3D 实体的边和顶点
- elasticsearch - ES query_string 对值的不同提升
- c# - 将列表转换为具有空值的对列表
- macros - 在宏中定义和使用函数
- javascript - Chart.js v2 中水平条形图的圆角
- javascript - 包含 jquery Dom 元素信息的 Javascript var