soql_queries {soql}R Documentation

SoQL Queries

Description

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

Usage

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

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)
}

[Package soql version 0.1.1 Index]