source_data: Load plain-text data from a URL (either http or https)
Description
source_data loads plain-text formatted data stored
at a URL (both http and https) into R.
Usage
source_data(url, sep, header)
Arguments
url
The plain-text formatted data's RAW URL.
sep
The separator method for the data. For
example, to load comma-separated values data (CSV) use
sep = ",". 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).
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 a URL.
Works with both HTTP and HTTPS sites. Note: the 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.
# Download electoral disproportionality data stored on GitHub# Note: Using shortened URL created by bitlyDisData <- source_data("http://bit.ly/Ss6zDO", sep = ",", header = TRUE)