Created
February 10, 2015 16:10
-
-
Save florianhartig/28e06a0ac1fc6d29af3b to your computer and use it in GitHub Desktop.
To source an R script over https, e.g. from a github repository
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from https://tonybreyal.wordpress.com/2011/11/24/source_https-sourcing-an-r-script-from-github/ | |
# and http://stackoverflow.com/questions/7715723/sourcing-r-script-over-https | |
source_https <- function(url, ...) { | |
# load package | |
require(RCurl) | |
# parse and evaluate each .R script | |
sapply(c(url, ...), function(u) { | |
eval(parse(text = getURL(u, followlocation = TRUE, cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl"))), envir = .GlobalEnv) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
I tried to source a function from a github R.script to my local working repository using your proposed "source_https" function, but it reported an error. For instance, if I run the code as follows to source your source_https.script, it reported:
Error in function (type, msg, asError = TRUE) :
error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version
Do you have any idea about this error?
Thanks in advance,
Qing