Skip to contents

Helpers for use in constructing conditions in queries.

Usage

equal(x)

any_of(...)

none_of(...)

not_equal(x)

between(...)

not_between(...)

greater_than(x, or_equal = FALSE)

less_than(x, or_equal = FALSE)

starts_with(x)

ends_with(x)

contains(x)

Arguments

x

input

...

input

or_equal

<lgl> append = to > or <

Value

An S7 <class_modifier> object.

Details

Query modifiers are part of a small DSL for use in query construction, in the JSON-API format.

Examples

if (FALSE) { # interactive()
equal(1000)
}
any_of(state.abb[10:15])
#> <any_of>
#>  @ operator : chr "IN"
#>  @ value    : chr [1:6] "GA" "HI" "ID" "IL" "IN" "IA"
#>  @ member_of: chr(0) 
none_of(state.abb[1:3])
#> <none_of>
#>  @ operator : chr "NOT+IN"
#>  @ value    : chr [1:3] "AL" "AK" "AZ"
#>  @ member_of: chr(0) 
not_equal(10000.23)
#> <not_equal>
#>  @ operator : chr "<>"
#>  @ value    : num 10000
#>  @ member_of: chr(0) 
between(1000, 1100, 125)
#> <between>
#>  @ operator : chr "BETWEEN"
#>  @ value    : num [1:2] 125 1100
#>  @ member_of: chr(0) 
not_between(0.95, 0.67, 0.75)
#> <not_between>
#>  @ operator : chr "NOT+BETWEEN"
#>  @ value    : num [1:2] 0.67 0.95
#>  @ member_of: chr(0) 
greater_than(1000)
#> <greater_than>
#>  @ operator : chr ">"
#>  @ value    : num 1000
#>  @ member_of: chr(0) 
greater_than(0.125, or_equal = TRUE)
#> <greater_than>
#>  @ operator : chr ">="
#>  @ value    : num 0.125
#>  @ member_of: chr(0) 
less_than(1000)
#> <less_than>
#>  @ operator : chr "<"
#>  @ value    : num 1000
#>  @ member_of: chr(0) 
less_than(0.125, or_equal = TRUE)
#> <less_than>
#>  @ operator : chr "<="
#>  @ value    : num 0.125
#>  @ member_of: chr(0) 
starts_with("foo")
#> <starts_with>
#>  @ operator : chr "STARTS_WITH"
#>  @ value    : chr "foo"
#>  @ member_of: chr(0) 
ends_with("bar")
#> <ends_with>
#>  @ operator : chr "ENDS_WITH"
#>  @ value    : chr "bar"
#>  @ member_of: chr(0) 
contains("baz")
#> <contains>
#>  @ operator : chr "CONTAINS"
#>  @ value    : chr "baz"
#>  @ member_of: chr(0)