Filter data.

action_filter_data(g, input, asp, operator = ">")

Arguments

g

An object of class g2r or g2Proxy as returned by g2() or g2_proxy().

input

The id of the input that triggers the filter, either input_select() or input_slider().

asp

Aspect (column) to filter.

operator

Operator of the filter, this is combined with the value from the input and the asp to form a filter statement with the following template; asp operator inputValue. For instance, a filter on input id = "theFilter" on the column speed (of the cars dataset) with the operator > (greater than) will create the following filter statement: speed > inputValue

Examples

# works in Rmarkdown
input_slider(
  "yFilter",
  "Filter Y >",
  value = 50,
  min = 40,
  max = 70,
  step = 5
)

g2(cars, asp(speed, dist)) %>%
  fig_point() %>%
  fig_smooth() %>%
  action_filter_data(
    "yFilter",
    dist,
    operator = ">"
  )