Skip to contents

This function replaces any values in x that are lower than bounds[1] by bounds[1], and replaces any values higher than bounds[2] by bounds[2].

Usage

squeeze(x, bounds = c(min(x[r]), max(x[r])), r = rep.int(TRUE, length(x)))

Arguments

x

A numerical vector with values

bounds

A numerical vector of length 2 containing the lower and upper bounds. By default, the bounds are to the minimum and maximum values in x.

r

A logical vector of length length(x) that is used to select a subset in x before calculating automatic bounds.

Value

A vector of length length(x).

Author

Stef van Buuren, 2011.