limiters: Limit a numeric to be within a certain range.

Description Usage Arguments Value Examples

Description

bound() limits a vector to a specific range. sever() trucates a vector to a specific quantile.

Usage

1
2
3
bound(x, min = NULL, max = NULL)

sever(x, pctl = 99)

Arguments

x

a numeric vector

min

minimum. Ignored if NULL.

max

maximum. Ignored if NULL.

pctl

percentile.

Value

a numeric vector

Examples

1
2
3
4
5
6
7
8
9
x <- rnorm(100, 8, 2)

#  cap at 10
bound(x, max = 10)

# truncate to 95th percentile
sever(x, pctl = 95)

bound(1:100, 25, 75)

malcolmbarrett/mbmisc documentation built on May 17, 2019, 8:16 a.m.