clip_interval: Clip all elements in an array to fall in an interval

View source: R/util.R

clip_intervalR Documentation

Clip all elements in an array to fall in an interval

Description

Clip all elements in an array to fall in an interval

Usage

clip_interval(x, lower = -Inf, upper = Inf)

Arguments

x

numeric array

lower

lower end of the interval

upper

upper end of the interval

Details

For each element X in x, clip_interval(X) equals lower if X<lower, upper if X>upper, and X otherwise. This function may be useful to clip predictions to fall in, e.g., [0,1].

Value

clipped array


QIU-Hongxiang-David/SDRsurv documentation built on March 29, 2024, 8:41 a.m.