power_mean: Power mean of vector elements

View source: R/power_mean.R

power_meanR Documentation

Power mean of vector elements

Description

power_mean() calculates the power mean of a set of values.

Usage

power_mean(values, order = 1, weights = rep(1, length(values)))

Arguments

values

Values for which to calculate mean.

order

Order of power mean.

weights

Weights of elements, normalised to 1 inside function.

Details

Calculates the order-th power mean of a single set of non-negative values, weighted by weights; by default, weights are equal and order is 1, so this is just the arithmetic mean. Equal weights and a order of 0 gives the geometric mean, and an order of -1 gives the harmonic mean.

Value

Weighted power mean

Examples

values <- sample(1:50, 5)
power_mean(values)


boydorr/RDiversity documentation built on May 6, 2022, 10:55 a.m.