Learn R Programming

tidytable (version 0.5.9)

between.: Do the values from x fall between the left and right bounds?

Description

between.() utilizes data.table::between() in the background

Usage

between.(x, left, right)

Arguments

x

A numeric vector of values

left, right

Boundary values

Examples

Run this code
# NOT RUN {
between.(1:10, 5, 7)

test_df <- data.table(
  x = sample(1:5, 10, replace = TRUE),
  y = sample(1:5, 10, replace = TRUE)
)

# Typically used in a filter.()
test_df %>%
  filter.(between.(x, 1,3))

# Can also use the %between% operator
test_df %>%
  filter.(x %between% c(1, 3))
# }

Run the code above in your browser using DataLab