powered by
For a numeric vector, move values below and above the q and 1-q quantiles to those quantiles.
winsorize(x, q = 0.006)
A vector like the input x, but with extreme values moved in to the q and 1-q quantiles.
x
q
1-q
Numeric vector
Lower quantile to use
x <- sample(c(1:10, rep(NA, 10), 21:30)) winsorize(x, 0.2)
Run the code above in your browser using DataLab