winsorize | R Documentation |
Replace extreme values by absolute or quantile threshold
winsorize(
x,
lo = NULL,
hi = NULL,
prob_lo = 0.025,
prob_hi = 0.975,
quantile_type = 7,
verbosity = 1L
)
x |
Numeric vector: Input data |
lo |
Numeric: If not NULL, replace any values in |
hi |
Numeric: If not NULL, replace any values in |
prob_lo |
Numeric (0, 1): If not NULL and |
prob_hi |
Numeric (0, 1): If not NULL and |
quantile_type |
Integer: passed to |
verbosity |
Integer: Verbosity level. |
If both lo and prob_lo or both hi and prob_hi are NULL, cut-off is set to min(x) and max(x) respectively, i.e. no values are changed
Numeric vector.
EDG
## Not run:
# Winsorize a normally distributed variable
x <- rnorm(500)
xw <- winsorize(x)
# Winsorize an exponentially distributed variable only on
# the top 5% highest values
x <- rexp(500)
xw <- winsorize(x, prob_lo = NULL, prob_hi = .95)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.