-
Notifications
You must be signed in to change notification settings - Fork 4
/
README.Rmd
119 lines (90 loc) · 3.26 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
align = "center"
)
```
# abjData <a href='https://abjur.github.io/abjData/'><img src='man/figures/logo.png' align="right" height="138.5" /></a>
<!-- badges: start -->
[![R build status](https://github.com/abjur/abjData/workflows/R-CMD-check/badge.svg)](https://github.com/abjur/abjData/actions)
[![CRAN status](https://www.r-pkg.org/badges/version/abjData/)](https://CRAN.R-project.org/package=abjData)
<!-- badges: end -->
## Overview
This package contains a set of databases frequently used by ABJ.
The data included comes from the Human Development Index of the municipalities, collected from the [Human Development Atlas](https://www.br.undp.org/content/brazil/pt/home/idh0/atlas-do-desenvolvimento-humano/atlas-dos-municipios.html) and [cartographic databases](ftp://geoftp.ibge.gov.br/cartas_e_mapas/bases_cartograficas_continuas/bc250/versao2015/Shapefile/).
The purpose of the package is to make databases available for quick use in other projects and as a resource for the Jurimetrics book.
## Installation
```{r eval=FALSE}
install.packages("abjData")
## dev version
# remotes::install_github("abjur/abjData")
```
## Available datasets
Dataset | Description
----------|----------
`assuntos`| Data that contains information about case types.
`cadmun` | (LEGACY) A dataset that contains the municipality codes.
`muni` | Useful data from municipalities to join with other databases.
`pnud_muni`| A dataset containing UNDP information from municipalities by years.
`pnud_min`| Minimal base of UNDP municipalities to make quick studies.
`pnud_siglas`| A dataset that serves as a glossary of available acronyms.
`pnud_uf`| A dataset that contains information about UNDP of Federative Units.
`leiloes`| Auctions dataset used in our book.
`consumo`| Consumer cases dataset used in our book.
## How to use
Once installed, just load the package and call the dataset you want to use.
The `{abjData}` package can be loaded like any other R package:
```{r message = FALSE}
library(abjData)
library(tidyverse)
```
```{r}
glimpse(pnud_siglas)
```
### Chart examples
Municipal Human Development Index:
```{r fig-idhm}
pnud_min |>
pivot_longer(starts_with("idhm")) |>
mutate(tipo = case_when(
name == "idhm" ~ "Geral",
name == "idhm_e" ~ "Education",
name == "idhm_l" ~ "Longevity",
name == "idhm_r" ~ "Income"
)) |>
mutate(
regiao_nm = fct_reorder(regiao_nm, value, median, .desc = TRUE),
tipo = lvls_reorder(tipo, c(2, 1, 3, 4))
) |>
ggplot() +
geom_boxplot(
aes(value, regiao_nm),
colour = "#102C68",
fill = "#7AD151"
) +
facet_wrap(~tipo) +
theme(legend.position = "none") +
theme_bw(12) +
labs(
x = "IDHM",
y = "Region"
)
```
Position of municipalities:
```{r}
muni |>
ggplot(aes(lon, lat)) +
geom_point(size = .1, colour = viridis::viridis(2, begin = .2, end = .8)[1]) +
coord_equal() +
theme_void()
```
## Requirements
`{abjData}` requires R version greater than or equal to 3.4.
## License
`{abjData}` is licensed under the [MIT License](https://github.com/abjur/abjData/blob/master/LICENSE).