harm: Harmonic mean

View source: R/harm.R

harmR Documentation

Harmonic mean

Description

This function calculates harmonic mean of a vector and can be used analogous to the base functions mean() or median()

Usage

harm(x, w = 1, na.rm = FALSE)

Arguments

x

(numeric vector)

w

(numeric vector) optional vector of weights corresponding to x. Default is 1 for all.

na.rm

(logical) If TRUE, then NA values are omitted and the mean calculated with the remaining values. If FALSE (default) then returns NA if x contains NA values.

Value

(numeric) harmonic mean of x

Examples

 harm(c(1:10))
 harm(c(1:10),c(10:1))




ConFluxPro documentation built on Aug. 8, 2025, 7:01 p.m.