Learn R Programming

mice (version 3.16.0)

squeeze: Squeeze the imputed values to be within specified boundaries.

Description

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)))

Value

A vector of length 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.

Author

Stef van Buuren, 2011.