clamp: Clamp a value into a range

Description Usage Arguments Value Author(s) References Examples

View source: R/clamp.R

Description

Splits paths into folders.

Usage

1
clamp(x, e1, e2 = -e1)

Arguments

x

vector

e1

the first edge

e2

the other edge, defaults to the negation of e1.

Value

x, with values outside the boundaries replaced with the boundary points.

Author(s)

josliber,

References

https://stackoverflow.com/questions/32599695/clamp-variable-within-range

Examples

1
2
3
clamp(-10:10, 2, -2)
clamp(-10:10, -2)
clamp(-10:10, 2)

stackoverflow documentation built on Jan. 10, 2020, 9:07 a.m.