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 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.
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?