Trim certain proportion of the most extreme values in a numeric vector.
trim(y, trim = 0.1, na.rm = FALSE, ...)
y | A numeric vector |
---|---|
trim | (number) A proportion of values to be removed. A number between 0 and 1. Default is 0.1. |
na.rm | (logical) if |
... | further argument to |
A trimmed vector.
1:10#> [1] 1 2 3 4 5 6 7 8 9 10# [1] 1 2 3 4 5 6 7 8 9 10 trim(1:10)#> [1] 2 3 4 5 6 7 8 9# [1] 2 3 4 5 6 7 8 9 trim(1:10, trim = 0.4)#> [1] 3 4 5 6 7 8# [1] 3 4 5 6 7 8