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

June 14, 2012
By

(This article was first published on Christopher Gandrud, and kindly contributed to R-bloggers)

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)  : SSL certificate problem, verify that the CA cert is OK. Details:error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

## 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)library(foreign)url <- "https://raw.github.com/christophergandrud/Disproportionality_Data/master/Disproportionality.csv"disproportionality.data <- getURL(url, ssl.verifypeer = FALSE)                disproportionality.data <- read.csv(textConnection(disproportionality.data))

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?

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

Tags: , , ,