Adjust outliers

adjust_outlier(x, q = 0.05)

Arguments

x

A numeric vector.

q

Percentile to adjust.

Details

Vaules larger than percentile 1 - q are adjusted to the 1 - q percentile and values smaller than percentile q are adjusted to the q percentile

Value

A numeric vector with same length as the original one.

Author

Zuguang Gu <z.gu@dkfz.de>

Examples

set.seed(123)
x = rnorm(40)
x[1] = 100
adjust_outlier(x)
#>  [1]  1.82969308  0.70610908  1.48902132 -1.81509255  0.33040958 -1.14215571
#>  [7]  0.15719342 -1.82760829 -0.44054688  0.00395328 -0.53711605 -0.01260453
#> [13]  0.17625437 -1.58368027  0.46779179  1.19461175  0.77458193  0.08710445
#> [19]  0.46911077  1.21997897 -0.26603284  0.32072041 -0.74705372 -0.21798121
#> [25] -0.51371691  0.60181312 -1.54982186 -1.70962283  0.77014880 -0.71687304
#> [31] -0.11175643  1.77391011  0.38757775  1.01403374  1.57900674  0.66875596
#> [37] -0.35352209 -1.40586827 -1.82760829  1.82969308