Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/322.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
运行GTrendR会产生一个';搜索量不足';错误_R - Fatal编程技术网

运行GTrendR会产生一个';搜索量不足';错误

运行GTrendR会产生一个';搜索量不足';错误,r,R,我在R3.0.1(Win64位)上运行以下代码。GTrendsR版本为1.2.1。 这个软件包的目的是访问谷歌趋势从R下载谷歌搜索频率 # First time execution install.packages("devtools") library("devtools") install_bitbucket("GTrendsR", "persican") # NORMAL execution library("GTrendsR") usr = "googleusername "

我在R3.0.1(Win64位)上运行以下代码。GTrendsR版本为1.2.1。 这个软件包的目的是访问谷歌趋势从R下载谷歌搜索频率

# First time execution
install.packages("devtools")
library("devtools") 
install_bitbucket("GTrendsR", "persican")



# NORMAL execution

library("GTrendsR")
usr = "googleusername "
psw = "password "
ch  <- gconnect(usr, psw,verbose=TRUE)
trends <- gtrends(ch, query = "facebook",geo = "CA", cat="0")

这个例子是为了检索“facebook”在加拿大的谷歌搜索频率,所以没有足够的搜索量来搜索“facebook”关键字是不可能的。非常感谢您的建议

这似乎是一个与两步身份验证相关的已知问题;有关详细信息,请参阅GitHub上的。该软件包的创建者推荐的解决方案是,在不进行两步认证的情况下设置第二个Google帐户,您只能将其用于这些类型的活动。也许该软件包的未来版本将使该建议变得毫无意义。

我与user3542643有相同的问题,但在使用了各种软件包之后,我无法在所有查询中可靠地重现它。事实上,现在我根本无法复制它,但我遇到了另一个错误消息的问题

第一个查询大部分时间都有效:

library(gtrendsR)
usr <- "xxxx"
psw <- "myPsw"
gconnect(usr, psw)
lang_trend <- gtrends(c("data is", "data are"), res="week")
库(gtrendsR)

usr获取以下错误消息

Error: Not enough search volume. Please change your search terms.
比如说,90%的概率意味着你实际上达到了某个配额限制。谷歌趋势(GoogleTrends)已逐步对数据量/每天可查询的数量以及每秒的速率设置了相当严格的限制。一些论坛讨论提到了这一点(例如)

我所看到的是

  • 有些人提到每天200次查询的限制
  • 如果速率太快,则在随机数次查询之后可能会发生错误
  • 设置一个随机的
    sys.sleep()
    并没有完全解决这个问题
  • 切换帐户以更改会话不起作用
  • 如果你太努力了,你的IP将被24小时禁止

我能想到的唯一解决方案是在浏览器中设置一个宏来“半手动”获取数据,到目前为止,谷歌没有对手动请求的数量设置任何限制。不过,我想他们甚至可以检测到,他们很好

您不认为错误消息可能会告诉您缩小搜索范围吗?谢谢。我试过几个关键词,结果总是一样的。这可能是与我自己的配置有关的某种错误。请在浏览器中查看Google Trends,了解您是否已达到配额限制,或者身份验证存在问题。在Google搜索了几周后,我发现python存在一个常见问题,以及R根据计算机/软件特定配置处理Cookie的方式。对于这个问题似乎没有简单的答案,所以我使用了更原始但有效的GTrends包。像这样的包如果明显损坏,应该从CRAN中删除
lang_trend <- gtrends(c("statistical learning", "implicit learning"), res="week")

Warning message:
In names(trend)[3:ncol(trend)] <- unlist(strsplit(queryparams[1],  :
number of items to replace is not a multiple of replacement length
Error: Not enough search volume. Please change your search terms.