github: Retrieve raw R code from an .R file hosted on github website

Description Usage Arguments Value Examples

View source: R/github.R

Description

Retrieve raw R code from an .R file hosted on github website

Usage

1
github(url, method, padding)

Arguments

url

Link to an R file on github website

method

Not all websites are formatted consistently. To overcome this, try a different method by setting the method parameter to integers 2 and greater to try other available methods

padding

Specify what goes between the last character of one code block and the first character of the next code block. Default is a two new lines, which appears visually as one new line between code blocks.

Value

A character vector of length 1 containing the R code from the target url. All code at the target url (including javascript, ruby, python) will be returned.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
library(dplyr)
github("https://github.com/hadley/vis-eda/blob/master/travel.R")

# Same as above but provided to cat for easy viewing
github("https://github.com/hadley/vis-eda/blob/master/travel.R") %>%
  cat

# A jupyter/ipython notebook

constructed_url <- paste0("https://github.com/tulip-lab/sit742/blob/",
  "master/Jupyter/SIT742P11A-MLlib-Supervised.ipynb")
github(constructed_url)

## End(Not run)

rawr documentation built on May 17, 2021, 5:07 p.m.

Related to github in rawr...