hutilscpp (version 0.1.0)

squish: 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

Run this code
# NOT RUN {
squish(-5:5,-1L, 1L)

# }

Run the code above in your browser using DataCamp Workspace