I also had problems with this before, and the solution that I consider the most reliable is to use the tiny modification of source_url from the fantastic package [devtools] [1]. This works for me (on Mac).
load_url <- function (url, ..., sha1 = NULL) { # based very closely on code for devtools::source_url stopifnot(is.character(url), length(url) == 1) temp_file <- tempfile() on.exit(unlink(temp_file)) request <- httr::GET(url) httr::stop_for_status(request) writeBin(httr::content(request, type = "raw"), temp_file) file_sha1 <- digest::digest(file = temp_file, algo = "sha1") if (is.null(sha1)) { message("SHA-1 hash of file is ", file_sha1) } else { if (nchar(sha1) < 6) { stop("Supplied SHA-1 hash is too short (must be at least 6 characters)") } file_sha1 <- substr(file_sha1, 1, nchar(sha1)) if (!identical(file_sha1, sha1)) { stop("SHA-1 hash of downloaded file (", file_sha1, ")\n does not match expected value (", sha1, ")", call. = FALSE) } } load(temp_file, envir = .GlobalEnv) }
I use a very similar change to get text files from github using read.table etc. Please note that you need to use the "raw" version of the github url (which you included in your question).
[1] https://github.com/hadley/devtoolspackage
source share