Skip to contents

Thin extender over DescTools::Winsorize for symmetric winsorisation by quantile (default 5\

Usage

morie_desc_winsorize(x, probs = c(0.05, 0.95), ...)

Arguments

x

A numeric vector.

probs

Length-2 numeric vector of lower / upper quantile probabilities, forwarded to DescTools::Winsorize.

...

Further arguments forwarded to DescTools::Winsorize (e.g. minval, maxval, na.rm).

Value

A list with $method = "DescTools::Winsorize" and $raw (the winsorised numeric vector).

Examples

if (requireNamespace("DescTools", quietly = TRUE)) {
  set.seed(1)
  head(morie_desc_winsorize(c(rnorm(48), 10, -10)))
}
#> $method
#> [1] "DescTools::Winsorize"
#> 
#> $raw
#>  [1] -0.62645381  0.18364332 -0.83562861  1.44288544  0.32950777 -0.82046838
#>  [7]  0.48742905  0.73832471  0.57578135 -0.30538839  1.44288544  0.38984324
#> [13] -0.62124058 -1.75598201  1.12493092 -0.04493361 -0.01619026  0.94383621
#> [19]  0.82122120  0.59390132  0.91897737  0.78213630  0.07456498 -1.75598201
#> [25]  0.61982575 -0.05612874 -0.15579551 -1.47075238 -0.47815006  0.41794156
#> [31]  1.35867955 -0.10278773  0.38767161 -0.05380504 -1.37705956 -0.41499456
#> [37] -0.39428995 -0.05931340  1.10002537  0.76317575 -0.16452360 -0.25336168
#> [43]  0.69696338  0.55666320 -0.68875569 -0.70749516  0.36458196  0.76853292
#> [49]  1.44288544 -1.75598201
#>