Learn R Programming

stackoverflow (version 0.7.0)

clamp: Clamp a value into a range

Description

Splits paths into folders.

Usage

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.

References

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

Examples

Run this code
# NOT RUN {
clamp(-10:10, 2, -2)
clamp(-10:10, -2)
clamp(-10:10, 2)

# }

Run the code above in your browser using DataLab