Squish into a range
squish(x, a, b, in_place = FALSE)
A numeric vector.
Upper and lower bounds
(logical, default: FALSE) Should the function operate on x in place?
FALSE
x
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.
a
b
# NOT RUN { squish(-5:5,-1L, 1L) # }
Run the code above in your browser using DataCamp Workspace