trim: Trim certain proportion of the most extreme values

Description Usage Arguments Value Examples

View source: R/trim.R

Description

Trim certain proportion of the most extreme values in a numeric vector.

Usage

1
trim(y, trim = 0.1, na.rm = FALSE, ...)

Arguments

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 TRUE, any NA and NaN's are removed from y before quantiles are computed.

...

further argument to stats::quantile().

Value

A trimmed vector.

Examples

1
2
3
4
5
6
7
8
1:10
# [1] 1 2 3 4 5 6 7 8 9 10

trim(1:10)
# [1] 2 3 4 5 6 7 8 9

trim(1:10, trim = 0.4)
# [1] 3 4 5 6 7 8

GegznaV/BioStat documentation built on Aug. 14, 2020, 9:30 p.m.