Update to Data on Github Post: Solution to an RCurl problem

[This article was first published on Christopher Gandrud, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

A reader of my most recent post tried the R code I had written to download the data set of electoral disproportionality from the GitHub repository. However, it didn’t work for them. After entering disproportionality.data <- getURL(url) they got the error message:

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

The Solution

The problem seems to be that they didn’t have a certificate from an appropriate signing agent (see the RCurl FAQ page (near the bottom) for more information. If you are really interested in SSL verification this page from redhat is a place to look).

The solution to this problem is pretty straightforward. As the RCurl FAQ page points out you can use the argument ssl.verifypeer = FALSE to skip certificate verification (effectively a man-in-the-middle attack).

So, if you get the above error message just use this new code:

library(RCurl)<br />library(foreign)<br /><br />url <- "https://raw.github.com/christophergandrud/Disproportionality_Data/master/Disproportionality.csv"<br /><br />disproportionality.data <- getURL(url, ssl.verifypeer = FALSE)                <br /><br />disproportionality.data <- read.csv(textConnection(disproportionality.data))<br />

That should work.

Question

I didn’t originally mention this issue, because I didn’t get it when I ran the code on my Mac. When I tried the code on a Windows machine I was able to replicate the error.

Does any reader know why Windows computers (or any other types) lack certificates from an appropriate signing agent needed to download data from GitHub? How can you get one?

To leave a comment for the author, please follow the link and comment on their blog: Christopher Gandrud.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)