means_choice {exams.forge}R Documentation

Means

Description

Computes the means of x. The list returned has an attribute "mindiff" which contains the smallest distance between two mean values before rounding. If winsor and/or trim is set to NA then the trimmed and/or winsorized means are not computed. Currently implemented are:

mean

arithmetic mean

median

median

harmonic

harmonic mean

geometric

geometric mean

mode

(first) mode

trim

trimmed mean

winsor

winsorized mean

Usage

means_choice(x, digits, na.rm = TRUE, trim = 0.2, winsor = 0.2)

means(x, digits, na.rm = TRUE, trim = 0.2, winsor = 0.2)

Arguments

x

numeric: data values

digits

numeric: integer indicating the number of decimal points for rounding (negative values are allowed)

na.rm

logical: should NAs be removed before?

trim

numeric: the fraction (0 to 0.5) of observations to be trimmed from each end of x

winsor

numeric: the fraction (0 to 0.5) of observations to be moved from each end of x

Value

A list with mean values.

Examples

x <- c(runif(9), 3)
means_choice(x, 2)

[Package exams.forge version 1.0.10 Index]