winsorize: Winsorize a vector

Description Usage Arguments Value Examples

View source: R/winsorize.R

Description

For a numeric vector, move values below and above the q and 1-q quantiles to those quantiles.

Usage

1
winsorize(x, q = 0.006)

Arguments

x

Numeric vector

q

Lower quantile to use

Value

A vector like the input x, but with extreme values moved in to the q and 1-q quantiles.

Examples

1
2
x <- sample(c(1:10, rep(NA, 10), 21:30))
winsorize(x, 0.2)

kbroman/broman documentation built on Sept. 24, 2018, 1:16 a.m.