title How to source .R scripts from github; works for (i) .R scripts stored in projects' repos or (ii) .R scripts saved as gists. author cgpu date output html_document toc toc_depth toc_float number_sections theme highlight true 3 true false united tango Locate GitHub hosted .R script Click on raw Copy URL Utilise the devtools::source_url function # Check if/Have `devtools` R package installed; if (!require("devtools")) install.packages("devtools") Store .R script's url in a variable; Do not omit the 'https://' part of the url URL = "https://raw.githubusercontent.com/cran/gower/master/R/gower.R" Source .R script remotely with devtools::source_url devtools::source_url(URL) Call a function from your script: gower_work( x = .. , y = .. , pair_x = .. , pair_y = .. , n = .. , eps = .. , nthread = .. )
Locate GitHub hosted .R script
rawUtilise the
source.gist()function from the R packageinstallrStore .R script's url in a variable;
Do not omit the 'https://' part of the url
Source .R script remotely with
source.gist()Call a function from your script: