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

View source: R/utility.R

harmonic_meanR 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)

bwiernik/configural documentation built on March 18, 2024, 11:02 p.m.