bounding: Bound or Divide/Round/Bound

Description Usage Arguments Value Examples

Description

Bound a number by two other numbers, or divide, round, and bound

Usage

1
2
3
bound(num, lower = -Inf, upper = Inf)

divide_round_bound(num, div = 1, lower = -Inf, upper = Inf, type = "round")

Arguments

num

Numeric vector to bound.

lower

Lower bound to floor the result at.

upper

Upper bound to cap the result at.

div

Numeric vector to divide num by.

type

Type of rounding to be performed (one of "floor", "ceiling", or "round").

Value

bound: bounded numeric vector.

divide_round_bound: divided, rounded, and bounded integer vector.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
bound(1:10, 2, 8)
bound(runif(10), 0.25, 0.75)
bound(1:5, upper = 3)
bound(1:5, lower = 3)

divide_round_bound(1:10, 2, 2, 4)
divide_round_bound(runif(10), 0.01, 20, 80)
divide_round_bound(1:100, 10, type = "ceiling")
divide_round_bound(1:100, 10, type = "floor")
divide_round_bound(1:100, 10, type = "round")
divide_round_bound(1:100, 10)

KO112/KO documentation built on Oct. 2, 2020, 9:21 a.m.