library(dplyr)
data("demo_gate_data", package = "tidygate")
# Gate points interactively
if(interactive()) {
mtcars |>
mutate(gated = gate(x = mpg, y = wt, shape = am))
}
# Gate points programmatically
mtcars |>
mutate(gated = gate(x = mpg, y = wt, programmatic_gates = demo_gate_data))
Run the code above in your browser using DataLab