harmonic.mean: Find the harmonic mean of a vector, matrix, or columns of a...

Description Usage Arguments Details Value Note Examples

Description

The harmonic mean is merely the reciprocal of the arithmetic mean of the reciprocals.

Usage

1

Arguments

x

a vector, matrix, or data.frame

na.rm

na.rm=TRUE remove NA values before processing

Details

Included as an example for teaching about functions. As well as for a discussion of how to estimate central tendencies.

Value

The harmonic mean(s)

Note

Included as a simple demonstration of how to write a function

Examples

1
2
3
4
5
6
7
8
x <- seq(1,5)
x2 <- x^2
x2[2] <- NA
X <- data.frame(x,x2)
harmonic.mean(x)
harmonic.mean(x2)
harmonic.mean(X)
harmonic.mean(X,FALSE)

frenchja/psych documentation built on May 16, 2019, 2:49 p.m.