metan (version 1.2.1)

hm_mean: Harmonic mean

Description

Helper function to compute the harmonic mean. The harmonic mean is the reciprocal of the arithmetic mean of the reciprocals.

Usage

hm_mean(x, ..., na.rm = TRUE)

Arguments

x

A numeric vector or a data frame.

...

Variables to compute the harmonic mean. If no variable is informed and x is a data frame, all the numeric variables will be used.

na.rm

A logical value indicating whether NA values should be stripped before computation proceeds.

Value

The harmonic mean(s) of x. If x is a numeric vector, the function returns a numeric value. If a data frame is used then a numeric vector with the harmonic mean for each variable is returned.

See Also

gm_mean

Examples

Run this code
# NOT RUN {
num <- c(1:10, 50)
hm_mean(num)

num_df <- make_mat(data_ge, ENV, GEN, GY)
hm_mean(num_df)
# }

Run the code above in your browser using DataCamp Workspace