trim_mean: Trimmed mean

Description Usage Arguments Details Value Examples

View source: R/locationEstimators.R

Description

trim_mean calculates a trimmed mean of a sample.

Usage

1
trim_mean(x, gamma = 0.2, na.rm = FALSE)

Arguments

x

a (non-empty) numeric vector of data values.

gamma

a numeric value in [0, 0.5] specifying the fraction of observations to be trimmed from each end of the sample before calculating the mean. The default value is 0.2.

na.rm

a logical value indicating whether NA values in x and y should be stripped before the computation proceeds. The default is na.rm = FALSE.

Details

This is a wrapper function for the function mean.

Value

The trimmed mean.

Examples

1
2
3
4
5
6
# Generate random sample
set.seed(108)
x <- rnorm(10)

# Compute 20% trimmed mean
trim_mean(x, gamma = 0.2)

robnptests documentation built on Nov. 8, 2021, 5:07 p.m.