winsorize {tidyfinance} | R Documentation |
Winsorize a Numeric Vector
Description
Replaces the values in a numeric vector that are beyond the specified
quantiles with the boundary values of those quantiles. This is done for both
tails of the distribution based on the cut
parameter.
Usage
winsorize(x, cut)
Arguments
x |
A numeric vector to be winsorized. |
cut |
The proportion of data to be winsorized from both ends of the
distribution. For example, a |
Value
A numeric vector with the extreme values replaced by the corresponding quantile values.
Examples
set.seed(123)
data <- rnorm(100)
winsorized_data <- winsorize(data, 0.05)
[Package tidyfinance version 0.3.0 Index]