lorenzgini is an R package that calculates the Gini coefficient and plots Lorenz curves. It builds on the
gini function from package
DescTools, and extends this function to the generalized Gini as derived in:
Bernasco, W. and W. Steenbeek (2017). More places than crimes: Implications for evaluating the law of crime concentration at place. Journal of Quantitative Criminology. https://doi.org/10.1007/s10940-016-9324-7
The most recent version of the package is:
Steenbeek, W., Bernasco, W. (2018). lorenzgini: generalized Gini for sparse data situations. R package version 0.1.1. URL: https://github.com/wsteenbeek/lorenzgini
lorenzgini using the
install_github function in the devtools package.
devtools::install_github("wsteenbeek/lorenzgini", force = TRUE)
How to start
After loading the package with
library(lorenzgini), see the documentation of the two functions (these include examples) by typing:
The package includes a vignette explaining the background and the functions in
lorenzgini in more detail. You can view the vignette available using:
To save time and because they may require additional packages,
devtools::install_github() may not build vignettes by default. If the command above returns that vignettes are not found, by far the easiest way to view the vignette is this direct link: Introduction to lorenzgini.
If instead you want to access the vignette from R itself, you need to take a few additional steps:
Install the rmarkdown package with
Install pandoc (and afterwards restart your computer)
Then, install the package again but force building of the vignettes using
devtools::install_github("wsteenbeek/lorenzgini", build_vignettes = TRUE, force = TRUE).
You should now be able to view which vignettes are available using:
To directly read the vignettes rather than going through
browseVignettes("lorenzgini") you can use:
vignette("lorenzgini", package = "lorenzgini")
This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 3, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the GNU General Public License for more details.
A copy of the GNU General Public License, version 3, is available at https://www.r-project.org/Licenses/GPL-3