Learn R Programming

descriptr (version 0.6.1)

ds_gmean: Geometric Mean

Description

Computes the geometric mean

Usage

ds_gmean(data, x = NULL)

Arguments

data

A numeric vector or data.frame.

x

Column in data.

Details

Any NA values are stripped before computation. The mean is computed on the log scale, so large values or long vectors do not overflow. If any value is less than or equal to zero, a warning is issued and NA is returned.

See Also

ds_hmean mean

Examples

Run this code
# vector
ds_gmean(mtcars$mpg)

# data.frame
ds_gmean(mtcars, mpg)

Run the code above in your browser using DataLab