Clamp a value to a specified range.

Share:

Description

Returns a vector of elements clamped to the specified minimum and maximum

Usage

1

Arguments

val

A value to clamp.

range

A vector of length 2 in the form c(min, max)

Value

A single value that is either unchanged or clamped upward to minimum or clamped downward to the maximum

Examples

1
MovetoRange(11, c(1,10))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.