means_choice: means_choice

means_choiceR Documentation

means_choice

Description

Computes mean's 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 set to NA then the trimmed and/or winsorized mean are not computed. Currently are implemented

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 places for rounding (negative values are allowed)

na.rm

logical: should NAs 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)

sigbertklinke/exams2moodle documentation built on July 6, 2023, 3:26 p.m.