Learn R Programming

enigma (version 0.1.1)

enigma_fetch: Download a gzipped csv file of a dataset.

Description

Download a gzipped csv file of a dataset.

Usage

enigma_fetch(dataset = NULL, path = NULL, overwrite = TRUE, key = NULL,
  ...)

enigma_read(input)

Arguments

dataset
Dataset name. Required.
path
File name and path of output zip file. Defaults to write a zip file to your home directory with name of the dataset, and file extension .csv.gz.
overwrite
Will only overwrite existing path if TRUE.
key
(character) Required. An Enigma API key. Supply in the function call, or store in your .Rprofile file, or do options(enigmaKey = ""). Obtain an API key by creating an account with Enigma at http://enigma.io,
...
Named options passed on to GET
input
The output from enigma_fetch or a path to a file downloaded from Enigma.io

Details

Note that enigma_fetch downloads the file, and gives back a path to the file. In a separte function, enigma_read, you can read in the data. enigma_fetch doesn't read in data in case the file is very large which may make your R session crash or slow down significantly.

Examples

Run this code
# After obtaining an API key from Enigma's website, pass in your key to the function call
# or set in your options (see above instructions for the key parameter)
# If you pass in your key to the function call use the key parameter

# Fetch the Crunchbase companies info dataset
res <- enigma_fetch(dataset='com.crunchbase.info.companies.acquisition')
enigma_read(res)

# Piping workflow
library('dplyr')
enigma_fetch(dataset='com.crunchbase.info.companies.acquisition') %>%
   enigma_read %>%
   glimpse

# Curl debugging
library('httr')
enigma_fetch(dataset='com.crunchbase.info.companies.acquisition', config=verbose())

Run the code above in your browser using DataLab