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.
NOTE: this command is depricated. Use source_data
instead.Usage
source_GitHubData(url, sha1 = NULL, sep = ",", header = TRUE, ...)
Arguments
url
The plain-text formatted data's RAW URL.
sha1
Character string of the file's SHA-1 hash,
generated by source_data.
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
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.From the source_url documentation: "If a SHA-1 hash is
specified with the sha1 argument, then this function will
check the SHA-1 hash of the downloaded file to make sure it
matches the expected value, and throw an error if it does
not match. If the SHA-1 hash is not specified, it will
print a message displaying the hash of the downloaded file.
The purpose of this is to improve security when running
remotely-hosted code; if you have a hash of the file, you
can be sure that it has not changed."
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