title | author | date | output | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
How to source .R scripts from github; works for (i) .R scripts stored in projects' repos or (ii) .R scripts saved as gists. |
cgpu |
|
- Click on
raw
- Copy URL
# Check if/Have `devtools` R package installed;
if (!require("devtools")) install.packages("devtools")
Do not omit the 'https://' part of the url
URL = "https://raw.githubusercontent.com/cran/gower/master/R/gower.R"
devtools::source_url(URL)
gower_work(
x = .. ,
y = .. ,
pair_x = .. ,
pair_y = .. ,
n = .. ,
eps = .. ,
nthread = ..
)
Locate GitHub hosted .R script
raw
Utilise the
source.gist()
function from the R packageinstallr
Store .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: