2

在继续之前,请RGoogleTrends_0.2-1.tar.gz 在此处下载,这是 Duncan Temple Lang 的网站。

可重现的示例(或者,至少,我希望它可以被某人重现):

op <- par(no.readonly = TRUE)
Sys.setenv(TZ = 'UTC')

# In the command line below please insert the path of your RGoogleTrends package

install.packages('C:/.../RGoogleTrends_0.2-1.tar.gz', repos = NULL, type = 'source')
install.packages('DBI')
install.packages('quantmod')
install.packages('RCurl')
install.packages('RSQLite')

require(DBI)
require(RCurl)
require(RGoogleTrends)
require(RSQLite)

我使用以下参数创建了一个 Google 帐户:

login = cicciopafolr@gmail.com
password = econfol1

然后RGoogleTrends代码:

# The example below comes from RGoogleTrends package.
## Not run: 
# Picks up c(login = password) from GooglePassword option
# i.e. set with
options(GooglePassword = c(cicciopafolr = 'econfol1'))
g = googleSignIn()
ans = getGTrends("coupon", curl = g)
## End(Not run)

代码结果:

> g = googleSignIn()
Error in function (type, msg, asError = TRUE)  : 
  SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

我的sessionInfo()

> sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

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

other attached packages:
 [1] RSQLite_0.11.3        RCurl_1.95-4.1        bitops_1.0-5          quantmod_0.4-0       
 [5] TTR_0.21-1            Defaults_1.1-1        DBI_0.2-6             RGoogleTrends_0.2-1  
 [9] Matrix_1.0-11         lattice_0.20-13       MASS_7.3-23           truncnorm_1.0-6      
[13] numDeriv_2012.9-1     xts_0.9-3             zoo_1.7-9             RcppArmadillo_0.3.6.3
[17] Rcpp_0.10.2           rcom_2.2-5            rscproxy_2.0-5       

loaded via a namespace (and not attached):
[1] grid_2.15.2  tools_2.15.2
4

1 回答 1

-1

我无法重现您的示例。调用getGTrends引发错误,但与 SSL 无关。您可以在运行代码之前尝试运行以下命令:

opts <- list(
  capath = system.file("CurlSSL", "cacert.pem", package = "RCurl"));
options(RCurlOptions = opts)

如果这不能解决您的问题,请尝试以下操作:

opts <- list(
  capath = system.file("CurlSSL", "cacert.pem", package = "RCurl"), 
  ssl.verifypeer = FALSE);
options(RCurlOptions = opts)

如果其中任何一个有效,那么您可能遇到了http://www.omegahat.org/RCurl/FAQ.html中描述的问题(在页面上搜索“当我尝试通过 https 与 URL 交互时,我得到一个表格错误')。请注意该页面关于使用ssl.verifypeer = FALSE.

顺便说一句,似乎在https://github.com/omegahat/RGoogleTrends上维护的软件包版本比您提供的存储库中的版本更新得更晚。

于 2013-04-30T11:39:46.430 回答