fclamp: Clamp a Numeric Vector Within a Range

View source: R/RcppExports.R

fclampR Documentation

Clamp a Numeric Vector Within a Range

Description

This function clamps (limits) the values of a numeric vector to lie within a specified range [a, b]. Values below a are set to a and values above b are set to b. Optionally, the operation can be performed in-place.

Usage

fclamp(x, a = 0, b = 1, inplace = FALSE)

Arguments

x

A numeric vector to be clamped.

a

The lower bound (default is 0.0).

b

The upper bound (default is 1.0).

inplace

Logical flag indicating whether to modify the input vector in place (default is false).

Value

A numeric vector with values clamped to the range [a, b].


ChristK/CKutils documentation built on April 11, 2025, 10:11 p.m.