build_filter: Build filter from tribble

View source: R/build_filter.R

build_filterR Documentation

Build filter from tribble

Description

Build filter from tribble

Usage

build_filter(filters, global_operator = "and")

Arguments

filters

tribble with columns

  • column

  • operator

  • value

Possible values for operator:

  • (not_)contains

  • (not_)icontains

  • start_with

  • ends_with

  • (not_)matches

  • eq

  • neq

  • (not_)empty

global_operator

"and" or "or"

Value

filter json encoded to feed to build_query

Examples

filters <- tibble::tribble(
 ~column, ~operator, ~value,
 "event_url", "matches", "Zamperoni",
 "event_url", "matches", "-1[34]"
)
# With optional transformation
filters <- tibble::tribble(
 ~column, ~operator, ~value, ~transformation,
 "event_url", "starts_with", "/medien", "to_path",
 "event_url", "matches", "-1[34]", NULL
)
 filters <- build_filter(filters, "and")

# If values of two or more different types are used use lists

filters <- tibble::tribble(
  ~column, ~operator, ~value,
  "device_type", "eq", list(0),
  "location_country_name", "eq", list("DE")
)

# This also works for transformation


piwikproR documentation built on Sept. 1, 2022, 5:07 p.m.