
Winsorize(x, minval = NULL, maxval = NULL, probs = c(0.05, 0.95), na.rm = FALSE)
quantile
. x
containing the winsorized data.
scale
, RobScale
Winsorize
library(robustHD)
contains an option to winsorize multivariate data## generate data
set.seed(1234) # for reproducibility
x <- rnorm(10) # standard normal
x[1] <- x[1] * 10 # introduce outlier
## Winsorize data
x
Winsorize(x)
# use Large and Small, if a fix number of values should be winsorized (here k=3):
Winsorize(x, minval=tail(Small(x, k=3), 1), maxval=head(Large(x, k=3), 1))
Run the code above in your browser using DataLab