action_filter_data: Filter Data

Description Usage Arguments Examples

View source: R/actions.R

Description

Filter data.

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# works in Rmarkdown
input_slider(
  "yFilter",
  "Filter Y >",
  value = 50,
  min = 40,
  max = 70,
  step = 5
)

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

## End(Not run)

devOpifex/g2r documentation built on Jan. 16, 2022, 12:36 a.m.