harmonic_mean {configural}R Documentation

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

Description

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

Usage

harmonic_mean(x, na.rm = TRUE, zero = TRUE)

Arguments

x

A vector, matrix, or data.frame

na.rm

Logical. If TRUE, remove NA values before processing

zero

Logical, If TRUE, if there are any zeroes, return 0, else, return the harmonic mean of the non-zero elements

Value

The harmonic mean of x

Author(s)

Adapted from psych::harmonic.mean() by William Revelle

Examples

harmonic_mean(1:10)

[Package configural version 0.1.5 Index]