Learn R Programming

descriptr (version 0.6.1)

ds_hmean: Harmonic Mean

Description

Computes the harmonic mean

Usage

ds_hmean(data, x = NULL)

Arguments

data

A numeric vector or data.frame.

x

Column in data.

Details

Any NA values are stripped before computation. If any value is less than or equal to zero, a warning is issued and NA is returned.

See Also

ds_gmean mean

Examples

Run this code
# vector
ds_hmean(mtcars$mpg)

# data.frame
ds_hmean(mtcars, mpg)

Run the code above in your browser using DataLab