Learn R Programming

repmis (version 0.2.3)

source_GitHubData: Load plain-text data from GitHub

Description

source_GitHubData loads plain-text formatted data stored on GitHub (and other secure-https-websites) into R.

Usage

source_GitHubData(url, sep = ",", header = TRUE)

Arguments

url
The plain-text formatted data's RAW URL.
sep
The separator method for the data. By default sep = "," to load comma-separated values data (CSV). To load tab-separated values data (TSV) use sep = "t".
header
whether or not the first line of the file is the header (i.e. variable names). The default is header = TRUE

Value

  • a data frame

source

Based on source_url from the Hadley Wickham's devtools package.

Details

Loads plain-text data (e.g. CSV, TSV) data from GitHub into R. The function is basically the same as source_data, but with defaults choosen to make loading CSV files easier. Note: the GitHub URL you give for the url argument must be for the RAW version of the file. The function should work to download plain-text data from any secure URL (https), though I have not verified this.

See Also

httr and read.table

Examples

Run this code
# Download electoral disproportionality data stored on GitHub
# Note: Using shortened URL created by bitly
DisData <- source_GitHubData("http://bit.ly/Ss6zDO")

Run the code above in your browser using DataLab