Learn R Programming

sjstats (version 0.17.4)

gmd: Gini's Mean Difference

Description

gmd() computes Gini's mean difference for a numeric vector or for all numeric vectors in a data frame.

Usage

gmd(x, ...)

Arguments

x

A vector or data frame.

...

Optional, unquoted names of variables that should be selected for further processing. Required, if x is a data frame (and no vector) and only selected variables from x should be processed. You may also use functions like : or tidyselect's select_helpers.

Value

For numeric vectors, Gini's mean difference. For non-numeric vectors or vectors of length < 2, returns NA.

References

David HA. Gini's mean difference rediscovered. Biometrika 1968(55): 573-575

Examples

Run this code
# NOT RUN {
data(efc)
gmd(efc$e17age)
gmd(efc, e17age, c160age, c12hour)

# }

Run the code above in your browser using DataLab