squish: Squish into a range

View source: R/squish.R

squishR Documentation

Squish into a range

Description

Squish into a range

Usage

squish(x, a, b, in_place = FALSE)

Arguments

x

A numeric vector.

a, b

Upper and lower bounds

in_place

(logical, default: FALSE) Should the function operate on x in place?

Value

A numeric/integer vector with the values of x "squished" between a and b; values above b replaced with b and values below a replaced with a.

Examples

squish(-5:5,-1L, 1L)


hutilscpp documentation built on Oct. 11, 2023, 9:06 a.m.