TwitteR searchTwitter()调用在for循环中不起作用

TwitteR searchTwitter()调用在for循环中不起作用,r,twitter,R,Twitter,我目前正试图通过searchTwitter()调用,让NBA 21名球员中的每一位都能获得100条关于他们的最新推文。然而,奇怪的是,这个调用在我的lastMVPs for循环(这是一个名称列表)中工作,但在经过10个循环后停止了,这将只有1000个API调用。现在,该调用仅在for循环之外时有效。有人知道这是为什么吗 例如,这项工作: searchTwitter("Lebron James", n = 2, lang = 'en') 但这并不是: for (name in lastMVPs)

我目前正试图通过searchTwitter()调用,让NBA 21名球员中的每一位都能获得100条关于他们的最新推文。然而,奇怪的是,这个调用在我的lastMVPs for循环(这是一个名称列表)中工作,但在经过10个循环后停止了,这将只有1000个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已经在循环外为我的调用工作时,它怎么能发挥最大作用呢?

(1)您对所有查询至少有100条tweet有多大信心?意思是,你确定它们都存在吗?(2) 我建议使用一个列表,例如
tmtx@r2evans(1)是一个很好的观点。我有“GiaNaAtEntokNoMPo”在那里,我高度怀疑甚至有10个Twitter与他的全名准确拼写在它。如果你必须使用一个宽格式(我强烈敦促你考虑使用一个高/长格式代替),然后至少把填充返回向量到一个最小的长度,如(在查询/过程函数),do<代码>长度(vec)