The Gini index of inequality across countries, optionally weighted (weight by population and the statistic describes inequality between people assigned their country's mean, not between country units).
See also
theil(), which adds a between/within-group decomposition.
Examples
snap <- countryatlas::world_snapshot$countries
gini(snap$gdp_per_capita) # between countries
#> [1] 0.635143
gini(snap$gdp_per_capita, weights = snap$population) # between people
#> [1] 0.6094909
