repmis (version 0.4.2)

source_DropboxData: Load plain-text data from Dropbox non-Public folders

Description

source_DropboxData loads plain-text formatted data stored on Dropbox in a non-Public folder.

Usage

source_DropboxData(file, key, sha1 = NULL, cache = FALSE,
  clearCache = FALSE, sep = "auto", header = "auto", ...)

Arguments

file
The plain-text formatted data's file name as a character string.
key
The file's Dropbox key as a character string.
sha1
Character string of the file's SHA-1 hash, generated by source_data.
cache
logical. Whether or not to cache the data so that it is not downloaded every time the function is called.
clearCache
logical. Whether or not to clear the downloaded data from the cache.
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
Logical, whether or not the first line of the file is the header (i.e. variable names).
...
additional arguments passed to fread.

Value

  • a data frame

source

Based on source_url from the Hadley Wickham's devtools package and url_dl from the qdap package. Data from: Gandrud, Christopher. 2013. "The Diffusion of Financial Supervisory Governance Ideas." Review of International Political Economy. 20(4):881-916

Details

Loads plain-text data (e.g. CSV, TSV) data from a Dropbox non-public folder. To download data from a Drobpox Public folder simply use read.table, giving the public URL as the file name.

To download data using source_DropboxData you will need (a) the file's name and (b) its Dropbox key. The key can be found by clicking "Share Link". The key will then be listed as part of the URL directly after "https://www.dropbox.com/s/" and before the file name.

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."

See Also

httr and fread

Examples

Run this code
# Download Financial Regulatory Governance data (see Gandrud 2012)
FinData <- source_DropboxData(file = "fin_research_note.csv",
                              key = "exh4iobbm2p5p1v",
                              sep = ",", header = TRUE)

Run the code above in your browser using DataLab