near_between {brolgar}R Documentation

Return x percent to y percent of values

Description

Return x percent to y percent of values

Usage

near_between(x, from, to)

Arguments

x

numeric vector

from

the lower bound of percentage

to

the upper bound of percentage

Value

logical vector

Examples

x <- runif(20)

near_middle(x = x,
            middle = 0.5,
            within = 0.2)

library(dplyr)
heights %>% features(height_cm, list(min = min)) %>%
  filter(near_between(min, 0.1, 0.9))

near_quantile(x = x,
              probs = 0.5, 
              tol = 0.01)

near_quantile(x, c(0.25, 0.5, 0.75), 0.05)

heights %>%
  features(height_cm, l_five_num) %>%
  mutate_at(vars(min:max),
            .funs = near_quantile,
            0.5, 
            0.01) %>%
  filter(min)

heights %>%
  features(height_cm, list(min = min)) %>%
  mutate(min_near_q3 = near_quantile(min, c(0.25, 0.5, 0.75), 0.01)) %>%
  filter(min_near_q3)

heights %>%
  features(height_cm, list(min = min)) %>%
  filter(near_between(min, 0.1, 0.9))

heights %>%
  features(height_cm, list(min = min)) %>%
  filter(near_middle(min, 0.5, 0.1))

[Package brolgar version 0.1.1 Index]