-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
102 lines (64 loc) · 3.36 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
## Overview
`lorenzgini` is an [R](https://www.r-project.org) 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
## Version
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.2. URL: https://github.com/wsteenbeek/lorenzgini
## Installation
You can install the package from this
[GitHub repository](https://github.com/wsteenbeek/lorenzgini). You first need to
install the [remotes](https://CRAN.R-project.org/package=remotes) package.
```{r, eval = FALSE}
install.packages("remotes")
```
Then install `lorenzgini` using the `install_github` function in the
[remotes](https://CRAN.R-project.org/package=remotes) package.
```{r, eval = FALSE}
remotes::install_github("wsteenbeek/lorenzgini")
```
## How to start
After loading the package with `library(lorenzgini)`, see the documentation of
the two functions (these include examples) by typing:
- `?gini`
- `?lorenz`
## Vignette
The package includes a vignette explaining the background and the functions in
`lorenzgini` in more detail.
By far the easiest way to view the vignette is this direct link, courtesy of the [GitHub HTML Preview service](http://htmlpreview.github.io/):
- [Introduction to lorenzgini](http://htmlpreview.github.io/?https://github.com/wsteenbeek/lorenzgini/blob/main/doc/lorenzgini.html)
If instead you want to access the vignettes from R itself you need to take a few additional steps, because `remotes::install_github()` does not build vignettes by default to save time and because it may require additional packages.
1. Install the rmarkdown package with `install.packages("rmarkdown")`
2. [Install pandoc](http://johnmacfarlane.net/pandoc/installing.html) (and afterwards restart your computer)
3. Then, install the package again but force building of the vignettes using `remotes::install_github("wsteenbeek/lorenzgini", build_vignettes = TRUE, force = TRUE)`. This will take a few minutes.
Afterwards, you should be able to view which vignettes are available using:
```{r, eval = FALSE}
browseVignettes("lorenzgini")
```
To directly read the vignettes rather than going through `browseVignettes("lorenzgini")` you can use:
```{r, eval = FALSE}
vignette("lorenzgini", package = "lorenzgini")
```
## License
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>