Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 26b4104085
Fetching contributors…

Cannot retrieve contributors at this time

25 lines (19 sloc) 0.919 kB
# Filename: source_https.R
# Purpose: function to source raw code from github project
# Author: Tony Bryal
# Date: 2011-12-10
# http://tonybreyal.wordpress.com/2011/11/24/source_https-sourcing-an-r-script-from-github/
# First found on:
# http://www.r-bloggers.com/source_https-sourcing-an-r-script-from-github-over-https/
source_https <- function(u, unlink.tmp.certs = FALSE) {
# load package
require(RCurl)
# read script lines from website using a security certificate
if(!file.exists("cacert.pem")) download.file(url="http://curl.haxx.se/ca/cacert.pem", destfile = "cacert.pem")
script <- getURL(u, followlocation = TRUE, cainfo = "cacert.pem")
if(unlink.tmp.certs) unlink("cacert.pem")
# parase lines and evealuate in the global environement
eval(parse(text = script), envir= .GlobalEnv)
}
# example:
# source_https("https://raw.github.com/talgalili/R-code-snippets/master/tabular.cast_df.r")
Jump to Line
Something went wrong with that request. Please try again.