Learn R Programming

CDF.PSIdekick (version 1.2)

MovetoRange: Clamp a value to a specified range.

Description

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

Usage

MovetoRange(val, range)

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

Run this code
MovetoRange(11, c(1,10))

Run the code above in your browser using DataLab