soql-package: Helps Make Socrata Open Data API Calls

Description Details Author(s) References Examples

Description

Used to construct the URLs and parameters of 'Socrata Open Data API' <https://dev.socrata.com> calls, using the API's 'SoQL' parameter format. Has method-chained and sensical syntax. Plays well with pipes.

Details

To create a SoQL URL, or just parameters for one, start with soql(). Then chain the result into other functions, such as soql_where() or soql_order(). When you're done, use as.character() to retrieve the finished URL, for use with any networking package.

Author(s)

Zeb Burke-Conte

Maintainer: "Zeb Burke-Conte" <zmbc@uw.edu>

References

Documentation for the SODA API

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
if (require(magrittr)) {
  # With pipes
  my_url <- soql() %>%
    soql_where("height > 30") %>%
    soql_limit(20) %>%
    as.character()
} else {
  # Without pipes
  soql_chain <- soql()
  soql_chain <- soql_where(soql_chain, "height > 30")
  soql_chain <- soql_limit(20)
  my_url <- as.character(soql_chain)
}

soql documentation built on May 2, 2019, 8:50 a.m.