As more and more data go online (plus we love Google Drive) we are forced to connect to our data over the net. We mostly do this via RCurl (but we could do this using RGoogleDocs as well).In that case all that is required to get the data into R is the two lines of code
require(RCurl)
myCsv<-getURL("https://docs.google.com/spreadsheet/pub?key=0AiD-
XfJ7BS9udG90TG9RZUQ2ZFZXMTRRNVZYU0Uxb1E&output=csv")
However, it's possible you end up with a message like this...All in all the point is that the data load *failed*.
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
In that case the solution is to add the ssl.verifypeer = FALSE to the getURL function to override the default behavior of R.
myCsv<-getURL("https://docs.google.com/spreadsheet/pub?key=0AiD-
XfJ7BS9udG90TG9RZUQ2ZFZXMTRRNVZYU0Uxb1E&output=csv", ssl.verifypeer = FALSE)
Note: The above holds for RGoogleDocs too, given that the package depends on RCurl for the heavy lifting.
A better solution is:
cert <- system.file("CurlSSL/cacert.pem", package = "RCurl") getURL(..., cainfo = cert)Rather than turning ssl checking off, this provides it with a standard certificate file.
(The httr package does this automatically)
True the ssl.verifypeer is a little brute (but it’s the thing it worked the first time I faced the problem
)
Haven’t tried the httr package.
Pingback: Download your Facebook photos using R « Stats raving mad
Thank you!!
I got the same error with
ROAuthdepending from Jeff Gentry’stwitteR. On the commandcred$handshake()(second to last page of http://cran.r-project.org/web/packages/twitteR/vignettes/twitteR.pdf) I replaced it withcred$handshake(ssl.verifypeer = FALSE)(following your lead) and it appears to be working.