clip_range: Snap a value to either the min or max if outside some range

Description Usage Arguments Details Examples

View source: R/stats.R

Description

If a value lies outside of some range, then this will snap to the limits

Usage

1

Arguments

x

numeric or integer value or vector of values

min

lower limit

max

upper limit

Details

Applies to vectors too

Examples

1
2
3
# snaps the vector below to the limits set
x <- c(-2,0,0.5,1, 1.25)
clip_range(x, 0, 1)

iamamutt/mejr documentation built on May 18, 2019, 1:27 a.m.