Last active
December 11, 2015 16:28
-
-
Save dgrapov/4627994 to your computer and use it in GitHub Desktop.
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
#load devium (or any other package) from github repo | |
source.git.hub<-function(url = "https://github.com/dgrapov/devium/tree/master/R") | |
{ | |
if(require(RCurl)==FALSE){install.packages("RCurl");library(RCurl)} else { library(RCurl)} | |
#get the names of all scripts to source | |
obj<-getURL("https://github.com/dgrapov/devium/tree/master/R",ssl.verifypeer=FALSE) | |
tmp<-strsplit(obj,'href=\"/') | |
tmp2<-unlist(strsplit(as.character(unlist(tmp)),'class')) | |
scripts<-gsub("/blob","",gsub('\" ',"",tmp2[grep("dgrapov/devium/blob/master/R/",tmp2)])) # fix formatting | |
#add http for git hub | |
scripts<-paste("https://raw.github.com/",scripts,sep="") | |
sapply(1:length(scripts),function(i) | |
{ | |
tryCatch( eval( expr = parse( text = getURL(scripts[i], | |
ssl.verifypeer=FALSE) ),envir=.GlobalEnv),error=function(e){print(paste("can't load:",scripts[i]))}) | |
}) | |
} | |
source.git.hub() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment