soql_queries: SoQL Queries

Description Usage Arguments Value References See Also Examples

Description

Wrapper functions around the SODA API's queries: select, where, order, group, and q.

Usage

1
2
3
4
5
soql_select(soql_list, select_clause)
soql_where(soql_list, where_clause)
soql_order(soql_list, column, desc = FALSE)
soql_group(soql_list, group_clause)
soql_q(soql_list, q_clause)

Arguments

soql_list

The soql object. If you don't have one yet, use the soql() function first. This can be piped in.

select_clause, where_clause, group_clause, q_clause

String to be used as the given clause in the query.

column

Column name to be ordered by.

desc

Whether to order descending.

Value

Returns a new soql object, with parameters added, for use in other functions.

References

Documentation about these queries on the SODA website

See Also

soql_simple_filter for an easier method of doing where with equality.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
if (require(magrittr)) {
  # With pipes
  my_url <- soql() %>%
    soql_select("height,weight") %>%
    soql_where("height > 30") %>%
    soql_order("height", desc=TRUE) %>%
    soql_group("type") %>%
    soql_q("a") %>%
    as.character()
} else {
  # Without pipes
  soql_chain <- soql()
  soql_chain <- soql_select(soql_chain, "height,weight")
  soql_chain <- soql_where(soql_chain, "height > 30")
  soql_chain <- soql_order(soql_chain, "height", desc=TRUE)
  soql_chain <- soql_group(soql_chain, "type")
  soql_chain <- soql_q(soql_chain, "a")
  my_url <- as.character(soql_chain)
}

Example output

Loading required package: magrittr

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