Control which records you receive from a SODA API

Share:

Description

This function adds a parameter to a soql object that controls what index the returned records start at. For more information, view the SODA documentation linked in the References section below.

Usage

1
soql_offset(soql_list, offset)

Arguments

soql_list

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

offset

Desired starting index of responses.

Value

Returns a new soql object, with an offset parameter added, for use in other functions.

References

Documentation on the SODA website

See Also

soql_limit

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
if (require(magrittr)) {
  # With pipes
  my_url <- soql() %>%
    soql_offset(50) %>%
    as.character()
} else {
  # Without pipes
  soql_chain <- soql()
  soql_chain <- soql_offset(soql_chain, 50)
  my_url <- as.character(soql_chain)
}