enigma_data: Fetch a dataset from Enigma.

Description Usage Arguments Value References Examples

Description

Fetch a dataset from Enigma.

Usage

1
2
3
enigma_data(dataset = NULL, limit = 500, select = NULL,
  conjunction = NULL, sort = NULL, page = NULL, where = NULL,
  search = NULL, key = NULL, ...)

Arguments

dataset

Dataset name. Required.

limit

(numeric) Number of rows of the dataset to return. Default (and max): 500

select

(character) Vector of columns to be returned with each row. Default is to return all columns.

conjunction

one of "and" or "or". Only applicable when more than one search or where parameter is provided. Default: "and"

sort

(character) Sort rows by a particular column in a given direction. + denotes ascending order, - denotes descending. See examples.

page

(numeric) Paginate row results and return the nth page of results. Pages are calculated based on the current limit, which defaults to 50.

where

(character) Filter results with a SQL-style "where" clause. Only applies to numerical columns - use the search parameter for strings. Valid operators are >, < and =. Only one where clause per request is currently supported.

search

(character) Filter results by only returning rows that match a search query. By default this searches the entire table for matching text. To search particular fields only, use the query format "@fieldname query". To match multiple queries, the | (or) operator can be used eg. "query1|query2".

key

(character) Required. An Enigma API key. Supply in the function call, or store in your .Renviron file like ENIGMA_KEY=your key), or in your .Rprofile file as options(enigmaKey = "<your key>"), Obtain an API key by creating an account with Enigma at http://enigma.io, then obtain an API key from your account page.

...

Named curl options passed on to HttpClient

Value

A list with items:

References

https://app.enigma.io/api#data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
## Not run: 
# 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

# White house visitor list
enigma_data(dataset='us.gov.whitehouse.visitor-list', limit = 10)

# White house visitor list - selecting three columns
enigma_data(dataset='us.gov.whitehouse.visitor-list', 
  select=c('namelast','visitee_namelast', 'last_updatedby'))

# White house visitor list - sort by last name
enigma_data(dataset='us.gov.whitehouse.visitor-list', sort='+namelast', 
  limit = 10)

# White house visitor list - get rows where total_people > 5
enigma_data(dataset='us.gov.whitehouse.visitor-list', 
  where='total_people > 5', limit = 10)

# White house visitor list - search for Vitale in full name field
## remove the 2nd at symbol before running
# enigma_data(dataset='us.gov.whitehouse.visitor-list', 
#   search='@namefull=Vitale')

# White house visitor list - search for SOPHIA in first name field
## remove the 2nd at symbol before running
# enigma_data(dataset='us.gov.whitehouse.visitor-list', 
#   search='@namefirst=SOPHIA')

# Domestic Market Flight Statistics (Final Destination)
dataset='us.gov.dot.rita.trans-stats.air-carrier-statistics.t100d-market-all-carrier'
enigma_data(dataset=dataset, limit = 10)

# Search for 'casa' in the Mexico's Social Security Department dataset
enigma_data('gov.mx.imss.compras.main', search='casa', 
  select=c('proveedor','fecha'), limit = 10)

## End(Not run)

ropengov/enigma documentation built on May 27, 2019, 1:51 p.m.